Nginx vs Apache: How to make the right choice


+1 vote

Good day to you!
My website has grown considerably lately and I would like to move to my own virtual server. Following your advice, I have chosen DigitalOcean hosting, but I faced the following matter: which to prefer - Apache, Nginx+Apache or Nginx+php-fpm?
What will be your advice?

asked Nov 12, 2016 in System administration by Sam

1 Answer

0 votes

Good day to you!
You are absolutely right to mention three of the most popular web server configurations - Nginx + PHP-fpm, Apache with PHP module and Nginx + Apache. Let's take a more detailed look into these configurations:

Nginx + PHP-fpm

Nginx + PHP-fpm vs Apache

In this case, all the static pages of your website are returned by Nginx and dynamic pages (PHP) are processed by PHP-fpm server. This is the most efficient configuration, enabling to support a site with high traffic at minimum expense. For example, to operate a site with traffic ranking of 10,000 unique hosts per day, you will need the cheapest DigitalOcean virtual machine for 5 dollars. The only drawback of this scheme is its relatively complicated customizing (in fact, there is nothing difficult about it). And, by the way, we have an article about this operation: Installing and configuring NGINX + PHP (PHP-fpm) on a Linux server.

Apache with php module

This is the most wide-spread configuration, it's supported by almost all the hosting control panels. Apache is known for operating quite slowly and requiring plenty of resources, that's why this configuration is not suitable for the sites with high traffic. If you need to allocate a number of small sites - this is the configuration for you. It's very easy to customize Apache with PHP module. For example, you can follow our instructions to install Webmin+Virtualmin control panel (article: How to install Webmin and Virtualmin on any Linux server) and you will get a ready server for hosting any number of small sites.

Nginx + Apache

I've never understood why system administrators use such a configuration. No doubt that nginx takes a part of Apache's duties, but it operates two-three times more slowly than Nginx + PHP-fpm. 
If you have any questions left or need more details - please, ask a question or leave a comment.

answered Nov 12, 2016 by Expert Brian (5,370 points)
Welcome to Help Desk, here you can ask any questions and receive answers from our experts and other members of the community.

If you have any questions, please do not hesitate to contact our help desk!

Make a question!