To achieve the best performance of a website, I set out to choose the right software stack.
Firstly, I installed varnish as a full page cache. This required a few configuration changes at:
/usr/lib/systemd/system/varnish.service
ExecStart=/usr/sbin/varnishd \
-j unix,user=vcache \
-F \
-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,2G
We change -a to 80, so it listens on port 80 for incoming requests, and we change malloc to 2G to allow it access to more RAM.
Secondly, I installed nginx as the web server, and set nginx to listen on port 8080.
Thirdly, I installed php 8.2 and 8.4 for the different websites. Some configuration changes I made are listed below:
memory_limit = 4G
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
This gives PHP more memory, and enables PHPs opcache for better performance.
Next I installed redis, as another caching layer. I set a password for authentication.
Lastly, I installed mariadb.