News for hackers. Stuff that matters.
Re:Nginx has replaced Apache as the most used web server amo... by dtech on Monday May 26, 2014 @07:34AM (#7799355)
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)

Re:Nginx has replaced Apache as the most used web server amo... by toni on Monday May 26, 2014 @08:01AM (#7799400)
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?
Re:Nginx has replaced Apache as the most used web server amo... by riquito on Monday May 26, 2014 @09:04AM (#7799569)
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 amo... by feld on Monday May 26, 2014 @09:49AM (#7799711)
I disagree. I don't care if nginx is in front of apache, varnish, or some ruby or python web server. If nginx is what serves the final request to the client, it's the webserver. Period.

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.

Re:Nginx has replaced Apache as the most used web server amo... by vegardx on Monday May 26, 2014 @10:18AM (#7799787)
If you start calling things like varnish a web server you'll confuse a lot of people. You generally call them according to what role they serve in your stack, and for Varnish and at times Nginx, that is a reverse caching proxy.
Re:Nginx has replaced Apache as the most used web server amo... by cma on Monday May 26, 2014 @10:14AM (#7799779)
By that logic (I'm not saying the conclusion is wrong), no one has fiber because we always end up translating it to electrical pulses before hitting the cpu, and chrome is the largest webserver because it always checks its own cache before going out to the network.
Re:Nginx has replaced Apache as the most used web server amo... by noselasd on Monday May 26, 2014 @09:57AM (#7799734)
Sure. But it doesn't make sense to not count the other web servers involved. (Even though that's often not possible)
Re:Nginx has replaced Apache as the most used web server amo... by inli3u on Monday May 26, 2014 @10:46AM (#7799893)
Depends, but from an application and development perspective, which I'm sure most are assuming here, no. If you can remove nginx and still serve your site/application, then nginx is not your web server. If nginx is acting as a reverse proxy or a cache, then that is all it is.
Re:Nginx has replaced Apache as the most used web server amo... by Aardwolf on Monday May 26, 2014 @10:58AM (#7799955)
By that logic, the webserver would be the last thing in front of the user, their router, their ISP, whatever...
Re:Nginx has replaced Apache as the most used web server amo... by fla on Monday May 26, 2014 @12:07PM (#7800308)
I dont agree. Their router processes data below the application layer. Thus why not define the webserver as the last server to serve at the http layer ?
Re:Nginx has replaced Apache as the most used web server amo... by thesnufkin on Monday May 26, 2014 @08:11AM (#7799417)
Good point, or perhaps more used as the LB? We prefer Varnish as the reverse proxy, but we are using nginx as load balancer, which still shows up as the server in the response header, even though we exclusively run apache on the back-ends to serve the PHP application. I am not sure how typical this setup is though.
Re:Nginx has replaced Apache as the most used web server amo... by harshreality on Monday May 26, 2014 @08:35AM (#7799467)
Unfortunately too typical. You're keeping all the performance issues with a LA<database>P stack (high resource-use variance going from low to high traffic), and merely adding layers in front. Unless you need an apachehttpd-specific feature, you should look into moving to a nginx + php-fpm setup.
Re:Nginx has replaced Apache as the most used web server amo... by ihsw on Monday May 26, 2014 @08:46AM (#7799501)
You're being awfully presumptuous -- there's nothing to indicate the parent isn't already using an apache2+php-fpm setup. Not all apache2+php users are using mod_php (which is where performance woes come from).
Re:Nginx has replaced Apache as the most used web server amo... by thesnufkin on Monday May 26, 2014 @10:50AM (#7799916)
Yeah, we are using apache2+php-fpm. The application behind is Drupal, which is supported on apache2 only (mostly) unfortunately.

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.

Re:Nginx has replaced Apache as the most used web server amo... by bigdubs on Monday May 26, 2014 @09:50AM (#7799714)
We use nginx as a load balancer on its own machine and distribute requests to a small farm of machines running windows/iis.

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.

Re:Nginx has replaced Apache as the most used web server amo... by yuchi on Monday May 26, 2014 @08:00AM (#7799396)
Nginx is used as a reverse proxy for less strong application servers. IMHO (and experience) doing it for Apache would be pretty useless.
Re:Nginx has replaced Apache as the most used web server amo... by jamescun on Monday May 26, 2014 @08:58AM (#7799554)
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 amo... by y0ghur7_xxx on Monday May 26, 2014 @12:31PM (#7800421)
> additionally you are spinning up a full PHP interpreter when serving static assets.

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.

Re:Nginx has replaced Apache as the most used web server amo... by stevekemp on Monday May 26, 2014 @11:22AM (#7800083)
I'd agree, but I suspect that anybody who cares about PHP-performance has probably already moved to FPM.
Re:Nginx has replaced Apache as the most used web server amo... by Supermighty on Monday May 26, 2014 @09:46AM (#7799705)
This was how we did it at my last job, a state university.
Re:Nginx has replaced Apache as the most used web server amo... by byroot on Monday May 26, 2014 @08:48AM (#7799515)
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 amo... by mgkimsal on Monday May 26, 2014 @09:03AM (#7799563)
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 amo... by seunosewa on Monday May 26, 2014 @09:15AM (#7799601)
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 amo... by jebblue on Monday May 26, 2014 @09:54AM (#7799725)
Doesn't that raise security concerns?
Re:Nginx has replaced Apache as the most used web server amo... by marcosdumay on Monday May 26, 2014 @10:33AM (#7799828)
Yes, it requires a sandbox for things like PHP.

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.

Re:Nginx has replaced Apache as the most used web server amo... by nkozyra on Monday May 26, 2014 @10:13AM (#7799774)
At absolute bare minimum it allows for error mitigation for the underlying server application.

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).

Re:Nginx has replaced Apache as the most used web server amo... by bowlofpetunias on Monday May 26, 2014 @02:49PM (#7800993)
Exactly. I have much more Apache servers than Nginx, but you can't see most of those Apache instances from the outside.
Re:Nginx has replaced Apache as the most used web server amo... by JimmaDaRustla on Monday May 26, 2014 @09:49AM (#7799712)
You reverse because you can't have two apps on the same port, obviously...but the real reason is because apache's lack of features...and apache is bad!

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.