Instalasi paket
sudo apt update sudo apt install -y php-curl php-gd php-intl php-mbstring php-soap php-xml \ php-xmlrpc php-zip php-mysql php-fpm apache2
Buat user untuk wordpress
sudo adduser wpuser chmod 755 /home/wpuser
Konfigurasi php-fpm : /etc/php/7.4/fpm/pool.d/www.conf
user = wpuser group = wpuser listen = /run/php/php7.4-fpm.sock listen.owner = wpuser listen.group = wpuser pm = dynamic pm.max_children = 50 pm.start_servers = 2 pm.min_spare_servers = 1 pm.max_spare_servers = 3
Aktifkan module rewrite untuk apache2:
a2enmod rewrite
Aktifkan module proxy & event
a2enmod proxy_fcgi setenvif a2dismod php7.4 mpm_prefork a2enmod mpm_event sudo apachectl -V | grep MPM
Optimasi modul event:
cd /etc/apache2/mods-enabled/
nano mpm_event.conf
<IfModule mpm_event_module>
KeepAlive On
KeepAliveTimeout 5
MaxKeepAliveRequests 128
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestWorkers 150
MaxConnectionsPerChild 0
</IfModule>
Konfigurasi Apache2 security : /etc/apache2/conf-enabled/security.conf
ServerTokens Prod ServerSignature Off TraceEnable Off #Header set X-Content-Type-Options: "nosniff" #Header set X-Frame-Options: "sameorigin"
Konfigurasi Apache2 : /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /home/wpuser/public_html
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost/"
</FilesMatch>
<Directory /home/wpuser/public_html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
Sesuaikan user apache2 : /etc/apache2/envvars
export APACHE_RUN_USER=wpuser export APACHE_RUN_GROUP=wpuser
Restart apache2 dan php-fpm:
sudo apachectl configtest sudo systemctl restart apache2 sudo systemctl restart php7.4-fpm
Instalasi Wordpres
sudo su - wpuser curl -LO https://wordpress.org/latest.tar.gz tar -xvzf latest.tar.gz mv wordpress public_html cd public_html/ cp wp-config-sample.php wp-config.php
Sesuaikan konfigurasi database: wp-config.php