Live data from Hacker News

Why Use Nginx?

wiki.nginx.org

61–70 of 91 posts

Re: Why Use Nginx?

#61

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…

Adding one more to that list-- you can host different domains on different ports (but your load balancer will need to for example direct :443 to :8443). This is common practice for people that use Amazon's ELB, for example.

Re: Why Use Nginx?

#62
post #34
post #11

Earlier 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…

Bit us in the behind as well, with a long-running report. I feel your pain.

Re: Why Use Nginx?

#63
I came across Nginx, for the first time today, when I was trying to figure how to make 'cleaner' URLs for the wiki I'm making. Totally going over my head and out of my comfort zone…what a coincidence this article pops up on HN the same day…maybe it's a sign I need to figure this Nginx thing out.

Thanks for the link!

Re: Why Use Nginx?

#64
I think ngninx is likely faster and more stable than apache, but I have yet to see anything close to a trustworthy benchmark.

I 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?

#66

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…

You can make your PHP/FastCGI directives all part of an include - then you don't have to edit a file for each vhost.

Re: Why Use Nginx?

#67
post #18

One 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…

I'm curious to know - did you consider Varnish? It's much faster as a rev proxy caching server.

Re: Why Use Nginx?

#68
I don't care whether it's for anti-wrinkle cream or a web server, I find testimonials about as useful as that ball of lint in my belly button and trustworthy as a used car salesman.

It'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?

#70
post #25

Though 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

Yes, I agree - nginx's community feels a little strange, at least to someone who hasn't tried to really get involved. Apache, by contrast, is a huge, loud, unruly crowd. Whereas the nginx author seems to be one of those quiet, aloof, l337 h4x0r types. Which is consistent with software that is a) really fast and b) not responsive to change requests. :)
Post reply on HN