Nginx has replaced Apache as the most used web server among the top 10,000 sites
w3techs.com
w3techs.com
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)
edit: nginx is the last mile. You can't say everyone in the USA has access to fiber because further upstream their traffic traverses a fiber network. Their last mile is DSL/Cable/etc. When it comes to the user experience, last mile is all that counts.
I guess from a higher perspective this is a support resource vs savings from technical performance question, but my feeling is that right now the lack of support knowledge and experience is more painful than the performance.
Nginx is great as a load balancer, not quite as sophisticated as HAProxy but the SSL support is good and it gets the job done pretty well.
I'm sure we're not the only ones.
[1] Was Co-Founder/CTO of a medium-sized PHP PaaS company
I think that if you do this you are one RewriteRule away from doing it right.
> In my experience[1], putting Nginx in front of Apache to serve static assets and leaving Apache as a sort of application server
I also think that using nginx only for static content is wasting perfectly good resources for nothing. Apache can serve static assets just as good as nginx does. No need for an other layer in your stack.
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...
If the nginx keep alive was set at 15 seconds, you'd have had a similar problem, no?
But it's limited to it. Most other web stacks come with their own sandbox. And Apache also puts PHP in a sandbox for unrelated issues.
In other words, your site doesn't necessarily have to be down even if Apache is down (assuming you're for some reason bound to Apache).
Even if apache is running in the background to serve up things like php, its most likely because there is some config that hasn't been converted to run the site on something like fast-cgi or FPM.
I wonder how something like haproxy appears when nginx is behind it.
If we consider a separate www.google.x for each country then we would get to around 100 very quickly, I guess.
The remainder would be filled by youtube, gmail, etc...
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.
Will it be noticeably faster than my current (tuned) Apache setup?
However, as well as speed there is also the amount of load that can be sustained. Nginx wins on this front as well as with speed.
As mentioned, run it on another port and see for yourself. When you are happy with it turn off apache on the chkconfig, set nginx to the other port, stop apache and run nginx -s reload to swap over the port. Yep, you can get the whole thing installed, tested and deployed without reboot or downtime!
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.
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.
"Then reduce the sample size!"
I use mod_jk with Apache. With mod_jk you use the AJP protocol to communicate with Tomcat. It's one line in your Apache config and a few lines in /etc/libapache2-mod-jk/workers.properties (Debian)
Are there any support for AJP for Nginx today?
You don't need AJP with NGINX; this enables you to easily work with any J2EE app server or web server . I ran into issues with configuring glassfish with Apache and thus began using NGINX. Why bother with AJP ?
Yes setting up NGIX as a reverse proxy for Tomcat/ Glasshfish whatever is very simple. Setp a NGINX on your desktop and you will never have to connect to port 8080 ever again. Also it can serve static content while lettting your app server handle application urls.
This gives you the HTTP Header, example output: HTTP/1.1 301 Moved Permanently Server: nginx Date: Mon, 26 May 2014 16:11:30 GMT Content-Type: text/html Content-Length: 178 Connection: keep-alive Location: http://ycombinator.com/
$ curl -I www.reddit.com
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
x-frame-options: SAMEORIGIN
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
Server: '; DROP TABLE servertypes; --
Date: Mon, 26 May 2014 18:37:12 GMT
Connection: keep-alive
Vary: accept-encoding"Usage of web servers broken down by ranking".
I'm picturing a graph of the most commonly broken web servers for half a second.
But, I actually did read that for a half a second and think the phrase "broken down" can be done without. It doesn't add anything in my opinion, I know it is broken down (its a graph), the phrase is unnecessary, and it caused me at least to stumble mentally for half an instant.
I can only imagine what these people are like in real life. I suppose aggression is necessary part of the human condition and that saddens me. But... hey, if it makes one feel powerful to down vote, go ahead. Personally I find it cowardly unless the person can take a second to explain why but whatever.... (Exceptions made for blatant cases of trolling and drop dead stupid comments of which yours was not one... and I appreciate the support. Thanks. PS. fellow UF alum! Looks like I graduated the year you started.).
The graph in the linked shows that "Apache is used by 60.5% of all the websites." while nginx is at 20.7%...
How could these numbers possibly mean that nginx has replaced Apache as the most used web server? When is 60.5% more than 20.7%? IS it opposite day?