Advertisement

Responsive Advertisement

Setup web server di Arch Linux

Setup Web Server di Arch Linux (LAMP Stack)

Berikut adalah langkah-langkah untuk menginstal dan mengkonfigurasi server web di Arch Linux menggunakan Apache, PHP, dan MariaDB.

1. Install Apache (httpd)

sudo pacman -S apache
sudo systemctl start httpd
sudo systemctl enable httpd

Setelah itu, cek apakah Apache berjalan dengan:

sudo systemctl status httpd

2. Install PHP

sudo pacman -S php php-apache

Edit file konfigurasi Apache:

sudo nano /etc/httpd/conf/httpd.conf

Tambahkan baris berikut di bagian bawah:

LoadModule php_module modules/libphp.so
Include conf/extra/php_module.conf

Restart Apache:

sudo systemctl restart httpd

3. Install MariaDB

sudo pacman -S mariadb
sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
sudo systemctl start mariadb
sudo systemctl enable mariadb

Amankan instalasi MariaDB:

sudo mysql_secure_installation

4. Install phpMyAdmin (Opsional)

sudo pacman -S phpmyadmin

Edit konfigurasi Apache:

sudo nano /etc/httpd/conf/httpd.conf

Tambahkan:

Include conf/extra/phpmyadmin.conf

Restart Apache:

sudo systemctl restart httpd

5. Setup Virtual Host

Edit file /etc/httpd/conf/httpd.conf dan tambahkan:

<VirtualHost *:80>
    ServerAdmin webmaster@myproject.test
    DocumentRoot "/srv/http/myproject"
    ServerName myproject.test
    <Directory "/srv/http/myproject">
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog "/var/log/httpd/myproject-error.log"
    CustomLog "/var/log/httpd/myproject-access.log" common
</VirtualHost>

Buat direktori:

sudo mkdir /srv/http/myproject
sudo chown -R http:http /srv/http/myproject

Tambahkan domain ke /etc/hosts:

echo "127.0.0.1 myproject.test" | sudo tee -a /etc/hosts

Restart Apache:

sudo systemctl restart httpd

6. Install Let's Encrypt SSL (Opsional)

sudo pacman -S certbot
sudo certbot --apache -d yourdomain.com

Dengan mengikuti langkah-langkah di atas, server web di Arch Linux sudah siap digunakan! 🚀

Posting Komentar

0 Komentar