Difference between nginx vs nginx_apache ?

ozgurerdogan

Verified User
Joined
Apr 20, 2008
Messages
352
What is the difference between nginx vs nginx_apache ? For best combitibility should I go with nginx_apache ? And performans with nginx ?
 
Nginx is better than Apache for serving static files (js, css, images), but not dynamic content (.php).

So with nginx_apache, static files are served by Nginx, and php files are processed by Apache, thus improve the performance.

And yes, for
compatibility (like .htaccess), you should chose nginx_apache.
 
It was explained above.

With "nginx" you will have only one http server which will handle everything - it will be nginx.

With "nginx_apache" there will be two http servers - nginx and apache. It will work like that:

1. A new connection arrives and nginx handles it. If it is for static file (not a php script), go to step 2, else go to step 3.
2. Nginx serves back the static file to the user
3. Nginx forwards the file to Apache. Go to 4.
4. Apache handles the php request - it tells php-fpm to compile it (if it is in fpm mode), etc. Go to 5.
5. Apache returns the output of the script to Nginx. Go to 6.
6. Nginx returns the file back to the user.

It is believed that this is the best setup in viewpoint of performance. Benchmarks show that nginx is faster than apache for static files while Apache is more widely spread and well known, so php software works better with it.

My personal opinion is that such setup while faster is a bit more problematic than the other. There are two things that can break. That's why I personally preferred to stay with Apache only and not use that reverse proxy setup.
 
Last edited:
My personal opinion is that such setup while faster is a bit more problematic than the other. There are two things that can break. That's why I personally preferred to stay with Apache only and not use that reverse proxy setup.

Do I do agree with the fact that the setup is a bit more advanced, calling it 'problematic' is a bit harsh. Using Custombuild the default configuration is done for you and runs in almost all cases without any problems. The reverse proxy setup (especially if you optimize it a bit), is not only faster but also using a lot less resources. So on high traffic websites this is a pretty important factor because in that case it stays fast and can handle more concurrent users with the same power.
 
Everything is problematic (you must support it, right?) but this is "just a bit more" :)
 
Back
Top