Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've seen millions of websites using nginx as a proxifying webserver working together with Apache. But I've seen very few servers running nginx only as their default webserver. What are the main downsides of such config?

I can see some:

  • Inability to use per-directory config files like .htaccess so every configuration change should be done to main server config file and requires server reload. But pecl htscanner can compensate them for php settings
  • Unavailability of mod_php for nginx, which can be compensated by php-fpm for example.

What are others? Why don't people just drop Apache and move to nginx or any other lightweight solution? May be, there are some special reasons?

EDIT: this question is primarily about working with LAMP stack.

share|improve this question
    
Mindshare, inertia, investment. Same as always. –  Ignacio Vazquez-Abrams May 11 '10 at 7:10
    
What investment needed to setup nginx on a new server? It's free opensource software. –  FractalizeR May 11 '10 at 8:11
3  
The investment of time required to research, deploy, test, etc. –  ThatGraemeGuy May 11 '10 at 8:27
    
If we are talking about quantity, IMHO the biggest reason is the huge number of shared hosts using Apache. Setting up nginx as a shared service (e.g. like in cPanel, Plesk, etc) is not yet as easy as doing the same with Apache, especially for the end-ish users. And I know many dedicated servers that run a single site, and yet use cPanel/Plesk/etc just because of the ease, familiarity and the low setup cost. –  Halil Özgür Nov 4 '11 at 18:18
add comment

3 Answers

up vote 8 down vote accepted

From my #nginx experience it is almost always because of familiarity with the Apache .htaccess files and not wanting to lose that or otherwise depending on it. For example people running shared server hosting who wants to offload static files only and keep apache for their users to fiddle with.

And I honestly can't really think of any other reasons for proxying to Apache other than keeping .htaccess for end-users.

Edit: Actually mod_php plus phpsuexec for shared hosts might be another reason for sticking with Apache.

share|improve this answer
    
From my experience it's pretty hard to get good performance from tomcat via nginx, as apache2's ajp-worker is notably faster under high pressure. I know that nginx has a experimental ajp13 implemention, but it's not stable and poorly documented. –  pauska May 11 '10 at 8:07
1  
That's very possible. Nginx works best as a fastcgi or HTTP 1.0 reverse proxy. I know there are 3rd party modules for talking with scgi, wsgi etc but I cannot say how stable they are, or even how fast they are. –  Martin Fjordvald May 11 '10 at 13:15
    
BTW, mod_php doesn't work with suexec. Suexec is for cgi applications. –  FractalizeR May 12 '10 at 7:15
    
Well there you go, no real reasons. Been an nginx user for too long to even remember Apache any longer. :D –  Martin Fjordvald May 12 '10 at 7:49
add comment

If you've got a bunch of people who can make Apache work well, why bother relearning a whole new app and configuration, migrate mod_rewrite rules, redo mod_perl/php/etc configurations, re-test, re-deploy?

Both software stacks may be free but, "re-train, re-develop, re-test" isn't, and it's time you could be adding features your users care about1, rather than tinkering for the sake of tinkering.

1 I'm obviously not talking about personal projects, there.

share|improve this answer
add comment

I like Nginx, but two things stop me from using it for my web sites.

  • It's hard to setup PHP-FPM. I haven't succeeded to do it with the latest PHP version yet.

  • Nginx hasn't support for HTML5 Websockets, which I'm interrested in.

share|improve this answer
1  
Can you name the difficulties you experienced with nginx and php-fpm? About HTML5 WebSockets, it looks like Apache hasn't them yet: issues.apache.org/bugzilla/show_bug.cgi?id=47485 –  FractalizeR May 11 '10 at 11:36
    
I'd like to know the php-fpm issues as well. If you can compile PHP from source without it then it's very simple to do it with it as well. –  Martin Fjordvald May 11 '10 at 13:16
1  
5.3 branch already has it inside, so just ./configure --enable-fpm and you are done. –  FractalizeR May 11 '10 at 13:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.