Live data from Hacker News

Why Use Nginx?

wiki.nginx.org

41–50 of 91 posts

Re: Why Use Nginx?

#41
post #15

Earlier quoted context omitted.

What does that mod do out of curiosity?

"mpm-itk allows you to run each of your vhost under a separate uid and gid—in short, the scripts and configuration files for one vhost no longer have to be readable for all the other vhosts" - http://mpm-itk.sesse.net/

I don't quite understand why that would be necessary. Nginx has no business accessing other users' files in the first place.

I mean, I understand why Apache needs to do it: with Apache, you have things like mod_php running in-process, so it makes sense to restrict Apache, running one of Bob's scripts, from accessing Alice's files.

But with Nginx, anything with "intelligence" runs out-of-process. What Nginx expects you to do is to run it as one user, but run each app server (in PHP terms, each FCGI socket daemon) as the user whose files that server should access. (Or, better yet, run the app server in an LXC container along with a bind mount to only the files it needs to access. Very Plan9y.)

Re: Why Use Nginx?

#42

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…

For my hobby programming server, I primarily use it to serve different web applications on different domains. The server is a proxy to web applications that listen on different ports on the server. This allows me to multiplex different web servers and relieves me of finding modules that glue together nginx and various programming languages.

Re: Why Use Nginx?

#43
post #41
post #15

Earlier quoted context omitted.

"mpm-itk allows you to run each of your vhost under a separate uid and gid—in short, the scripts and configuration files for one vhost no longer have to be readable for all the other vhosts" - http://mpm-itk.sesse.net/

I don't quite understand why that would be necessary. Nginx has no business accessing other users' files in the first place. I mean, I understand why Apache needs to do it: with Apache, you have things like mod_php running in-process, so it makes sense to restrict Apache, running one of Bob's scripts, from accessing Alice's files. But with Nginx, anything with "intelligence" runs out-of-process. What Nginx expects yo…

It may still be a good idea for security reasons. Suppose that an Nginx process is exploited. If it runs under a certain user ID then the exploit likely does not travel past that user. You can make the Nginx user ID different from the actual user ID so that it only has read access.

Re: Why Use Nginx?

#44

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…

Unless I'm missing something you only need to have a version Apache that supports SNI then have NameVirtualHost for your https port. If your os/distro doesn't make that version easily available then I can see how it might take extra work to get SNI support.

Re: Why Use Nginx?

#45
post #44

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…

Unless I'm missing something you only need to have a version Apache that supports SNI then have NameVirtualHost for your https port. If your os/distro doesn't make that version easily available then I can see how it might take extra work to get SNI support.

What I should have said was that I've been too lazy (like to an extreme degree) to host multiple SSL sites using SNI. Just buying another IP was easier for me. It's probably stupid to do that but that's just me.

Re: Why Use Nginx?

#46

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…

My mistake. I was always told Nginx can serve multiple SSL sites with no extra work required besides the usual configuration you'd change for a single SSL site.

Re: Why Use Nginx?

#47
post #24

Every single project, open source or not, needs to have a "Why Use It" page. (Now this is more of a "Testimonials" page, but for server tech it will do.) > Apache is like Microsoft Word, it has a million options but you only need six. Nginx does those six things, and it does five of them 50 times faster than Apache. This is exactly how I felt. I'm a pea-brained dolt in the server sphere, and when I was remaking my se…

Yep feature comparisons, benchmarks even if never perfect,.. and.. what this cruft is for, are, well, useful. But yep also, this nginx page is a testimonial page. Testimonial pages bring very little value as it's 100% subjective, and usually just "fanboy" content. And the 2nd half of your post is equivalent. Personally I find Apache easier to configure, and with mpm-event its as fast as nginx (albeit both are fine ht…

My favourite testimonial was a generic 'I like this product' that was signed 'anonymous'. Yes, the product is so good, I won't put my name to it. Maybe if the testimonial said something specific, but as it stood it was pretty laughable.

Re: Why Use Nginx?

#48
post #40
post #22

Earlier quoted context omitted.

That's a pretty broad statement to make... You are assuming that out there only "your app" exists. Actually, many times "your app" is somebody else's app that you bought or an app that somebody else develops and you don't have any control over it. Sometimes those apps are just bad (well, most enterprise apps are) and your only hope is that the infrastructure that you do happen to control doesn't make it worse. I've n…

> However, having a reverse proxy retrying _any_ requests to backends by default seems very bad form to me. Do you want your routers resending packets? It's the same thing. No: HTTP GET is explicitly idempotent and cachable. As an HTTP client, you are supposed to be able to send the same GET all day, and it's up to the server to not screw that up.

I'm not saying that it's a standards violation or anything like that. I'm not even arguing against GET retries, but only against them being default.

Bad behavior from apps you don't control is a fact of life. Ignoring it doesn't make it go away, and behaving like it doesn't exist can make it worse.

Re: Why Use Nginx?

#49

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…

Get a cheap load balancer that can make better decisions because it's operating at the HTTP layer... oh, nginx! :-)

Re: Why Use Nginx?

#50

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 don't need fast go to serve php through nginx. You can - and probably should - just use nginx as a reverse proxy in front of php-enabled apache. Best of both world.

Nginx+PHP-FPM blows the doors off of Apache+mod_php. Why "should" you do this?
Post reply on HN