Panduan Instalasi LAMP + WordPress
Versi ini ditata ulang total dengan desain clean putih-biru agar terlihat profesional dan tidak mirip sumber lain.
1. Persiapan Sistem
Update Sistemsudo dnf update -y
Melakukan pembaruan paket agar sistem stabil dan kompatibel.
Install LAMP Stacksudo dnf install httpd mariadb-server mariadb php php-mysqlnd php-fpm -y
- httpd → Apache Web Server
- mariadb-server → Server database
- php & php-mysqlnd → PHP & driver MariaDB
- php-fpm → Handler PHP berbasis FastCGI
sudo systemctl enable --now httpd sudo systemctl enable --now mariadb sudo systemctl enable --now php-fpm
2. Konfigurasi MariaDB
Amankan MariaDBsudo mysql_secure_installationBuat Database & User
CREATE DATABASE wordpress CHARACTER SET utf8mb4; CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'wpuser123'; GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost'; FLUSH PRIVILEGES;Jika user sudah ada
ALTER USER 'wpuser'@'localhost' IDENTIFIED BY 'wpuser123'; FLUSH PRIVILEGES;
3. Upload & Ekstrak WordPress
sudo mv latest.tar.gz /var/www/ cd /var/www sudo tar -xvzf latest.tar.gz sudo chown -R apache:apache wordpress sudo chmod -R 755 wordpressJika ada instalasi lama:
sudo mv /var/www/wordpress /var/www/wordpress_old
4. Konfigurasi Apache
Contoh Virtual Host:<VirtualHost *:80>
ServerName 123.456.789.101
DocumentRoot /var/www/wordpress
<Directory /var/www/wordpress>
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/wordpress_error.log
CustomLog /var/log/httpd/wordpress_access.log combined
</VirtualHost>
Aktifkan mod_rewrite
sudo dnf install mod_rewrite -y sudo systemctl restart httpd
5. Konfigurasi PHP-FPM
sudo nano /etc/php-fpm.d/www.conf
Pastikan isinya:
listen = /run/php-fpm/www.sock listen.owner = apache listen.group = apache listen.mode = 0660 user = apache group = apache
Tambahkan handler PHP:
<FilesMatch \.php$> SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost/" </FilesMatch>
6. SELinux & Firewall
sudo chcon -R -t httpd_sys_rw_content_t /var/www/wordpress sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https sudo firewall-cmd --reload
7. Troubleshooting
| Masalah | Penyebab | Solusi |
|---|---|---|
| Service Unavailable | Apache tidak terhubung dengan PHP-FPM | Periksa socket & pastikan php-fpm berjalan |
| Error DB Connection | User / password salah | Cek wp-config.php & akses MariaDB |
| Forbidden | Permission atau SELinux | Gunakan chown / chcon |
8. Testing WordPress
Buka: http://IP_SERVER
Komentar
Posting Komentar