views:

908

answers:

2

Ok, I have seen this question quite a few times here on SO and as well as elsewhere on the web. But..they are all pretty old, so I will post it again.

I have the following needs:

  1. Ability to handle lots of simultaneous HTTP connections (like comet). This is the reason I am looking at other webservers rather than apache.

  2. Should be easy to install and run PHP

  3. Need reverse proxy for channeling certain requests to an alternate web server (apache or yaws) on another port.

I know nginx does not have fast cgi support by default. While lighthttpd seems to have that, I read complaints about memory leaks. Is the memory leak problem still prevalent?

What would you recommend now: nginx or lighthttpd? Or something else? Why?

A: 

Both have pretty excellent performance. Using FastCGI with Lighttpd is a bit easier, because it is able to spawn processes by itself (downside is that it runs fastcgi servers as the same user as the webserver), while nginx requires a bit of manual work. Both are perfectly capable of acting as reverse proxy and load balancers.

If you need good performance, I'd also suggest to use nginx as front-end to serve static files, and Apache backend. While this requires more RAM, nginx+apache2+mod_php is somehow faster than nginx+php-fastcgi. I currently have no proof benchmarks, though, so take this statement with a grain of salt.

Also, IMHO nginx has somehow more human-friendly configuration file syntax, but opinions may vary.

drdaeman
A: 

Apache is king of the web servers for a reason, has excellent PHP support, and plugins for caching and reverse proxying. Why are you trying to reinvent the wheel?

Chris Kaminski
Because it's (not unlike King Kong) a little bit big ;-)! (but anyway great for 80%-90% of the projects)
Yes, I have used apache for many years without any issues. However, this particular project needs a light weight webserver which can server requests fast, and as robust apache might be, its too much of a hog currently.
In rebuttal to the -1 someone slapped on me, you want PHP support and reverse caching - easily something that can eat your performance if you have to spawn multiple processes to do page parsing. If all you wanted was a simple http server that spit out static HTML or images, I might agree with you, but this isn't what he wanted - your going to lose all that performance in interpretation anyway.
Chris Kaminski