Configuration After Installing WordPress

Show some configuration after installing WordPress.

Optimize PHP config

Open /etc/php/$VERSION/apache2/php.ini and change the values below.

max_execution_time = 1800
max_input_time = 1800
memory_limit = 512M
post_max_size = 512M
upload_max_filesize = 512M
max_file_uploads = 100

Install necessary PHP extensions

Install GMP and BCMath.

apt install php-bcmath php-gmp

Remove unused softwares

Remove snap and ufw completely.

apt purge snapd ufw
apt autoremove --purge

Optimize Apache config

Open /etc/apache2/sites-available/default-ssl.conf and add the lines below in proper areas.

SSLProtocol -all TLSv1.3
SSLCipherSuite TLSv1.3 TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
SSLHonorCipherOrder on
SSLCompression off
SSLSessionTickets off
SSLUseStapling on
SSLStaplingCache shmcb:ssl_stapling(32768)
RewriteEngine on
RewriteCond %{HTTP_HOST} !^your-domain
RewriteRule ^(.*) https://your-domain$1 [R=301]

Refuse visits via IP address

Open /etc/apache2/sites-available/000-default.conf and /etc/apache2/sites-available/default-ssl.conf, then add the lines below in proper areas.

<VirtualHost *:$PORT>
    ServerName $IP
    <Location />
        Order allow,deny
        Deny from all
    </Location>
</VirtualHost>