Sentora, comes with Apache 2.2 and I feel that it’s a bad solution when there are many good solutions already for using as web server e.g. Litespeed, NginX, Lighttpd etc. Litespeed is a paid service. If you have the ability to pay for it, you should use it as it is very good Benchmark test results. The person, like me, should go through the most of the benchmark test results. Then you will see that NginX, one of the best web server, has a very good reputation. After Apache, NginX has the most market share about to 14%. But NginX need PHP-FPM to work sound. Sentora comes with PHP 5.3. Nginx working here as reverse proxy in front of Apache.
At first, we will make Apache default port changed to a non-standard port. We will edit httpd-vhosts.conf file & change port 80 to port 8081.
Then we need to install NginX on our server. I am using CentOS 7.3 (64-bit) so I am telling you the installation process on CentOS server. For more info or other OS based servers, follow NginX Installation Wiki to get it installed. If you can’t or get any error, let me know I will help you as far as I can.
We have to add NginX yum repository. Enter following command:
Now paste the following configurations in it:
[nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1
Use this command to install NginX:
yum install nginx
So, NginX has been installed on the server. Now we will edit nginx.conf file. Use the following command:
Delete all default lines and paste the following lines:
Find the following lines:
Here our Nginx will listen to port 8083 as I also tell you how to set up Varnish Cache on your server. But if you want to use only NginX in front of Apache then change the port to 80. Hope you understand!
Let’s try to set up Varnish Cache now. Something about Varnish Cache. Apache+NginX+Varnish combination requires a higher RAM. Varnish Cache is a web application accelerator known as a caching HTTP reverse proxy. It uses RAM for caching as RAM is faster than our hard-disk.
To install Varnish cache, enter these commands:
We have to change Varnish default backend port to 8083 on default.vcl. Use this command:
Now set .port=”8083”;
Then we have to edit /etc/sysconfig/varnish file and change VARNISH_LISTEN_PORT to 80. Have you done this? It’s time we should restart Apache and start NginX & Varnish (if you use) for working together. Enter following commands:
That’s all. Now you should check your CPU and RAM usage. I hope you will see them in better health. For Apache+NginX+Varnish combination, Varnish works in front of NginX and NginX works in front of Apache, i;e;Varnish works in front of all.
For Apache+NginX combination, NginX works in front of Apache simply.