L
L
LittleMeN2011-09-03 13:58:35
PHP
LittleMeN, 2011-09-03 13:58:35

Apache, NGINX, PHP-FPM - which is better?

Good day,
I apologize for my novice ignorance, but I just drowned in tons of comparisons, what is better, I emphasize better, not faster!
The task is approximately the following:
A small multilingual site on the Silex Framework, cloud hosting on Amazon - micro instance, ubuntu, php, mysql.
But with a bunch of problems, what will be the optimal solution in terms of speed / resources:
1. nginx-front and apache-back + mod_php
2. nginx + php-fpm
3. bare nginx
4. bare apache + mod_php
or other options
... understandable that xcache, memcached and other methods of speeding up the resource are required.
But the main question is which bundle to choose as the most productive and less resource-dependent?
Indeed, in the case of gluttony in terms of resources, I will have to quickly switch to paid Amazon instances, and I don’t want to overpay for the load of an illiterately chosen architecture. On the other hand, optimization for eating up resources can have a detrimental effect on speed, which is also not great.
I beg you to share your personal experience and recommendations, especially with links to setup manuals for beginners.
And I beg you not to make a brawl out of this issue - I really need a solution, and not thoughts on the tree or srach in the comments.
Thanks to everyone who will respond!

Answer the question

In order to leave comments, you need to log in

12 answer(s)
Z
zizop, 2011-09-21
@zizop

Our tests showed a significant speedup with nginx +php5-fpm compared to apache+mod_php. It's time to use progressive technologies, and not install Apache the old fashioned way. Here is our recipe:
- actually nginx + php5-fpm
- apc for local cache, memcached for network
- Percona XtraDB database, then switched to MariaDB + XtraDB
- ssd for the axis, turn off logging, turn on trim
- daily backup on hdd, weekly via network .
In general, these activities have significantly increased productivity.

A
ajaxtelamonid, 2011-09-03
@ajaxtelamonid

Better - nginx-front and apache-back + mod_php, since this is a solution to the main problem of Apache - memory consumption when returning statics, and the absence of shit pain in converting .htaccess rules to nginx rules.
Faster - nginx + php-fpm.
But since you need “better, not faster!”, Take the first option.

C
CKPbITHUK, 2011-09-03
@CKPbITHUK

I would choose php-fpm + nginx, since it consumes quite a bit of memory and is generally not gluttonous and very fast.
But as everyone here has already said, there is no universal solution.

E
Elkaz, 2011-09-03
@Elkaz

There is no universal solution.
We settled on php-fcgi + nginx for our project

A
andoriyu, 2011-09-05
@andoriyu

nginx + apache + php-fpm. Gives nginx, php-fpm goodies, saves .htaccess goodies.

V
Vladimir, 2011-09-10
@merdoc

I would choose nginx + php-fpm + apc
if connected via socket on the same server

E
Evgeny Bezymyannikov, 2012-04-18
@psman

nginx on the front + apache on the back
bundle is no worse than nginx + php5-fpm
difference in percentages that do not play a role

V
Vladson, 2011-09-03
@Vladson

I fully support Mr. Elkaz, there can be no ideal solution in principle.
I would personally recommend to install what the admin can manage (he can't install, but in general, even in a critical situation when everything goes wrong as it should be ...) This is the most important factor.
And yes, many engines require Apache rewrite, so sometimes there is no choice as such. However, if there is still a choice, I would still prefer the nginx options.

L
LittleMeN, 2011-09-03
@LittleMeN

Thanks everyone!
I will install nginx and php-fpm, study the issue in more detail, and perhaps experiment with other options, but based only on nginx with a different “body kit”.

A
akzhan, 2011-09-04
@akzhan

nginx + node.js + express + jade.

M
mobilez, 2011-09-06
@mobilz

I have not seen anything more convenient than mod_php. More flexible than apache + mod_php you will not find unambiguously.
On the other hand, I personally have not configured apache for 5 years, i.e. switched to nginx+php-fcgi. I have enough + for my projects speed is required. More precisely, the lack of brakes in trivial tasks. And in general, there is enough functionality and flexibility. But mod_php is clearly more flexible.

R
RomanKu, 2020-01-23
@RomanKu

I had experience hosting sites on this type of instance. In terms of memory and speed, the nginx + php-fpm bundle proved to be better, and even now I see no reason to start a project with Apache. The database will be tight on the RAM and it will periodically issue friezes related to working with the disk.
Again, from the experience on t2-micro, screwing CloudFlare gives a significant reduction in server load due to static caching and, accordingly, reducing the number of requests to the server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question