Live data from Hacker News

Nginx has replaced Apache as the most used web server among the top 10,000 sites

w3techs.com

21–30 of 76 posts

Re: Nginx has replaced Apache as the most used web server among the top 10,000 sites

#21
post #4
post #2

Couldn't these results be skewed because Nginx is often used as a reverse proxy? If there is Apache or something custom behind Nginx it will show up as Nginx I guess. I do not see this issue adressed and it might cause significant skew if you look at the top websites (since they will more often deploy these kinds of tricks)

Nginx is used as a reverse proxy for less strong application servers. IMHO (and experience) doing it for Apache would be pretty useless.

Depends. I remember having an issue with an apache/mod_php app that was using way too much memory.

The app was doing polling every 10 seconds and apache had a 15 seconds keep alive. So each user of the app was maintaining an apache process alive.

Disabling the keep-alive was not acceptable, so I just threw nginx in front to do the keep-alive, memory usage was immediately reduced by ~75%.

If I knew apache better I might have been able to do it with just apache, but nginx is so simple to use...

Re: Nginx has replaced Apache as the most used web server among the top 10,000 sites

#22
post #12

Any opinions on Nginx being more difficult to setup/run than Apache? I'm considering switching, but I really have enough overhead to deal with!

Just give it a go. Remember you can set it up to run on another port, e.g. 81, 8080 etc. so you can get it working whilst still having Apache up and running on your site. For popular CMS applications you can normally find some helpful .conf file to get you started. You will also need to setup php-fpm if you are running a PHP flavoured 'LAMP' stack.

Cool! I never thought of that!

Will it be noticeably faster than my current (tuned) Apache setup?

Re: Nginx has replaced Apache as the most used web server among the top 10,000 sites

#23
post #6

can someone link up a good "nginx for newbies" type resource for someone who is familiar with programming?

I hope it's kosher that I link my own blog since it deals specifically with nginx: http://blog.martinfjordvald.com/2010/07/nginx-primer/

Re: Nginx has replaced Apache as the most used web server among the top 10,000 sites

#24
post #12

Any opinions on Nginx being more difficult to setup/run than Apache? I'm considering switching, but I really have enough overhead to deal with!

If you have anything to do with Drupal (and possibly Wordpress) as well, you might run into issues.

At least concerning Drupal, a lot of plugins require changes to the .htaccess file(s), and at least when I tried, this was hard to translate to nginx.

But there are some .htaccess to nginx converters, so I'm not sure if that is a big issue at this time.

And as others have said, you might find the nginx approach to be much more comfortable than .htaccess. I did.

Re: Nginx has replaced Apache as the most used web server among the top 10,000 sites

#25
post #4
post #2

Couldn't these results be skewed because Nginx is often used as a reverse proxy? If there is Apache or something custom behind Nginx it will show up as Nginx I guess. I do not see this issue adressed and it might cause significant skew if you look at the top websites (since they will more often deploy these kinds of tricks)

Nginx is used as a reverse proxy for less strong application servers. IMHO (and experience) doing it for Apache would be pretty useless.

Depends heavily on how you have configured Apache. If you are using something like PHP and the forking model (most common MPM configuration), you can only handle as many requests as you have workers; additionally you are spinning up a full PHP interpreter when serving static assets. In my experience[1], putting Nginx in front of Apache to serve static assets and leaving Apache as a sort of application server is one of the lowest hanging fruit in scaling a LAMP application.

[1] Was Co-Founder/CTO of a medium-sized PHP PaaS company

Re: Nginx has replaced Apache as the most used web server among the top 10,000 sites

#26
post #21
post #4

Earlier quoted context omitted.

Nginx is used as a reverse proxy for less strong application servers. IMHO (and experience) doing it for Apache would be pretty useless.

Depends. I remember having an issue with an apache/mod_php app that was using way too much memory. The app was doing polling every 10 seconds and apache had a 15 seconds keep alive. So each user of the app was maintaining an apache process alive. Disabling the keep-alive was not acceptable, so I just threw nginx in front to do the keep-alive, memory usage was immediately reduced by ~75%. If I knew apache better I mig…

wouldn't just changing the apache keep alive have been even easier than setting up a whole other web server and adding that to the mix?

If the nginx keep alive was set at 15 seconds, you'd have had a similar problem, no?

Re: Nginx has replaced Apache as the most used web server among the top 10,000 sites

#27
post #5
post #2

Couldn't these results be skewed because Nginx is often used as a reverse proxy? If there is Apache or something custom behind Nginx it will show up as Nginx I guess. I do not see this issue adressed and it might cause significant skew if you look at the top websites (since they will more often deploy these kinds of tricks)

Isn't it considered best practice to serve your static files through Nginx itself and only reverse proxy requests for dynamic endpoints? And if that's the case, Shouldn't Nginx be counted as a full web server?

You can configure Nginx to cache and serve html or as a load balancer. In these cases it isn't the "real" web server, and it's common.

Re: Nginx has replaced Apache as the most used web server among the top 10,000 sites

#29
post #21

Earlier quoted context omitted.

Depends. I remember having an issue with an apache/mod_php app that was using way too much memory. The app was doing polling every 10 seconds and apache had a 15 seconds keep alive. So each user of the app was maintaining an apache process alive. Disabling the keep-alive was not acceptable, so I just threw nginx in front to do the keep-alive, memory usage was immediately reduced by ~75%. If I knew apache better I mig…

wouldn't just changing the apache keep alive have been even easier than setting up a whole other web server and adding that to the mix? If the nginx keep alive was set at 15 seconds, you'd have had a similar problem, no?

No. Because Nginx doesn't dedicate a thread or process to each open connection.

Re: Nginx has replaced Apache as the most used web server among the top 10,000 sites

#30
post #24
post #12

Any opinions on Nginx being more difficult to setup/run than Apache? I'm considering switching, but I really have enough overhead to deal with!

If you have anything to do with Drupal (and possibly Wordpress) as well, you might run into issues. At least concerning Drupal, a lot of plugins require changes to the .htaccess file(s), and at least when I tried, this was hard to translate to nginx. But there are some .htaccess to nginx converters, so I'm not sure if that is a big issue at this time. And as others have said, you might find the nginx approach to be m…

Drupal works flawlessly with Nginx[1], and there is little magic involved. You even have good handling of private files, permission and such.

There's only a few modules that require changes to the default ".htaccess" (basically just overriding Apache default logic) of Drupal, like the module Boost. But since Nginx can serve as both a application server and reverse proxy, you can have the best of both worlds, without doing hack-y things like Boost, which basically generates a lot of static files.

You don't want to use those converters, as they usually rely heavily on ifs, which is a bad thing, when things normally can be handled pretty well with the "try_files"-directive.

[1] I've been using it in my stack for a couple of dozen Drupal sites for about two years now.

Post reply on HN