12

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.

Vladislav Rastrusny
  • 2,581
  • 12
  • 39
  • 56
  • 1
    Mindshare, inertia, investment. Same as always. – Ignacio Vazquez-Abrams May 11 '10 at 07:10
  • What investment needed to setup nginx on a new server? It's free opensource software. – Vladislav Rastrusny May 11 '10 at 08:11
  • 3
    The investment of time required to research, deploy, test, etc. – ThatGraemeGuy May 11 '10 at 08: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 04 '11 at 18:18

3 Answers3

9

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.

Martin Fjordvald
  • 7,589
  • 1
  • 28
  • 35
  • 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 08: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. – Vladislav Rastrusny May 12 '10 at 07: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 07:49
6

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.

Jeff Atwood
  • 12,994
  • 20
  • 74
  • 92
Rodger
  • 609
  • 4
  • 6
2

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.

Jonas
  • 1,147
  • 5
  • 17
  • 31