I've used Apache exclusively for the last 3 years until just a few months ago when I set up another server to host a number of sites I wanted to move off Apache and on to Nginx. After having used both, and trying real hard here not to start a religious war as is what happens often in these kinds of discussions, I have to say neither is "better" overall or in general in my experience. If you're familiar with Apache co…
> I love being able to host multiple SSL sites on a single IP with no hoops to jump through with Nginx. On Apache your options are to acquire more IPs or set up SNI which for me was more hassle than it was worth. What? Neither Apache nor nginx can serve multiple SSL sites off a single IP without a UCC certificate, SNI, or multiple IPs. SSL requests have their Host header encrypted, which means the server doesn't know…
Why Use Nginx?
61–70 of 91 posts
Re: Why Use Nginx?
#62Earlier quoted context omitted.
Oh really, does it do it for POSTs? It should retry for GET, but not POSTs (which is exactly why there is a difference). If you have non-idempotent GETs in your app, then that's the app's fault. If Nginx is retrying POSTs then it's Nginx's fault.
It definitely did it for POST. That is what surprised us. We had a lot of users added and as I said the few second operation started taking much longer and we discovered it was because their spreadsheet uploaded was getting uploaded again and again because it kept timing out. Was not fun. The "feature" is 'proxy_next_upstream'. We spent time cursing this Nginx definition of a feature. http://serverfault.com/questions…
Re: Why Use Nginx?
#63Thanks for the link!
Re: Why Use Nginx?
#64I come from the php world, and people always say how much lower-memory nginx+php-fpm is than apache+mod_php. Well no doubt! If you understand how the architecture actually works, it's clear this isn't a fair comparison. mod_php means php is fully-loaded for serving statics, not to mention having a smaller pool of php-fpm processes will take less memory and also be faster (due to less context-switching) than the larger number of mod_php processes.
However the real comparison should be between nginx+php-fpm and apache+mpm_event+php-fpm. Nginx is an evented server, so at least try to compare apples-to-apples. I've seen very few comparisons of nginx with mpm_event.
Also, apache's default tunings are much more geared towards modest server usage whereas nginx's seem more geared towards high scalability. An argument could be made that apache should have "better" defaults, but since at scale you need to start tweaking your OS/rlimit/etc to prevent bad things from happening you can see why apache might stick with more modest tunings ootb.
Our app has a lot of apache custom config and so I was a hesitant to try to switch to nginx due to the risk of getting things wrong porting the configs. We did move from apache/mod_php to apache+mpm_worker and php-fpm and we've been able to improve throughput (especially on statics) at a far lower memory footprint. Key to success in lowering the memory footprint was dropping ThreadStackSize (from 8M default to 1M). What a difference!
Other than that, the competition is good for everyone. I am sure nginx pushed apache to work on mpm_event much harder.
Re: Why Use Nginx?
#65nginx's ssi capability is so bare currently. however, it is an excellent reverse proxy for me.
Re: Why Use Nginx?
#66I've used Apache exclusively for the last 3 years until just a few months ago when I set up another server to host a number of sites I wanted to move off Apache and on to Nginx. After having used both, and trying real hard here not to start a religious war as is what happens often in these kinds of discussions, I have to say neither is "better" overall or in general in my experience. If you're familiar with Apache co…
Re: Why Use Nginx?
#67One thing I still don't understand is why one would use a proxy server at all? Why not just have your load balancers (which can operate cheaply at the TCP layer) throw traffic directly at your application servers? If you need caching, that's cheap to do, too. If you need static file serving, can't you another load balancer end-point that points directly at static content servers, or make your application servers fast…
It's a good question. We (a large-scale website serving 250,000 pages/day) use Python+CherryPy for our "application server", but that's sitting behind an nginx reverse proxy. The main reason is that nginx is much better and faster at handling certain things than Python: * handling HTTPS and serving plain old HTTP to the application server so Python doesn't have to worry about it * doing the gzipping of content before…
Re: Why Use Nginx?
#68It's true many of benchmarks out there use flawed methodologies, so lets try to fix that. When you benchmark something as complex as Apache, people are going to find faults with your initial run, no matter how careful you are. This is why you need to be completely transparent with you setup configuration and should be prepared for a followup run with user suggested settings.
Re: Why Use Nginx?
#69Re: Why Use Nginx?
#70Though I do use nginx and am very happy with it, I am somewhat put off by the fact that I reported a bug five months ago (including a working patch for the problem) and no one seems to have as much as looked at it [1]. (Granted, this is in a module, not in the core server, but in general the community process for the project seems messy and vague.) [1]: http://trac.nginx.org/nginx/ticket/242