Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want an alternative for apache, lighthttpd has memory leaks problems so i can't go for it, i keep reading that nginx is good for static content but is it good for php-mysql dynamic video sharing content?

I have read also that a good option is to run apache and nginx together for dynamic content, but i don't want to use apache at all - apache uses so much ram, that's why i want to use nginx in the first place!

and my last question, is lighthttpd still suffering from memory leaks problems or did they fix it, because I would love to use that, I read somewhere that youtube uses it, and my site is so similar to youtube (not the same though, but if it's good enough for youtube, it's good enough for me)

share|improve this question
    
Do you have an actual problem with Apache or do you just think "Ah, it uses soooo much memory"? Also, if there is indeed a problem with Apache's memory consumption, are you sure it doesn't come from the scripts generating the dynamic content, which are obviously the same with any other web server? –  SvW Aug 31 '11 at 10:26
    
@SvenW I have a video sharing site and my friend has a mp3 search engine and again apache uses too much ram, maybe we created bad scripts, i'm not gonna rewrite a huge script, i'm not discussing my coding skills just wanna know if nginx alone can handle dynamic content and if lighthttpd still has memory leaks problems –  user Aug 31 '11 at 10:47
    
Define "too much". And if the scripts use lot's of RAM (which doesn't necessarily mean they are bad, maybe their task inherently requires lot of RAM), switching to another web server won't help you. –  SvW Aug 31 '11 at 10:52
    
@SvenW denine too much: my friend friend has a about around 600mb of rams... when he runs the server and start the online radio on his site, 24% is used, if the vps keeps running for 1h you cannot access the site anymore –  user Aug 31 '11 at 11:06
    
btw the radio is hosted on another vps, so technically the search engine is using everything –  user Aug 31 '11 at 11:07
show 2 more comments

2 Answers

up vote 8 down vote accepted

To be blunt, anyone who runs nginx proxied to Apache (or vice versa) needs their head examined. It doesn't help anything useful, and I wish all the articles recommending it would die in a fire.

That little rant done, nginx is as good for dynamic content as you'd ever want -- it proxies all dynamic content to a backend application server, which is the best model for such things, as it allows the appserver to run as the application user, rather than as the webserver user (which has been a source of much security hilarity over the years). In speed terms it's slightly slower than Apache running mod_php, but not enough that you'll notice (your scripts' runtime will dwarf that of the time added by shunting the request to an appserver).

As far as lighttpd goes, I'd treat as a dead technology. It was great in it's day, but nginx has eaten it's lunch and it's time to let the old gal retire to a quiet pasture.

share|improve this answer
    
Do you have tests that show it's slightly slower? I have run some very basic non-scientific tests myself and there wasn't even what I would call slight differences. –  Martin Fjordvald Aug 31 '11 at 11:53
    
Yes, I have run the tests, and as you note, you can't tell the difference unless you're really looking hard for them. In practical terms, there's no value in worrying about it. –  womble Aug 31 '11 at 20:16
    
+1 for the rant –  jaks Jul 11 '13 at 11:07
add comment

IMHO, proxy nginx to Apache or vice versa is stupid, especially when the server is on a Un*x system. One can proxy nginx to the unix socket of php. Although unix socket is recommended, tcp socket performs way better than proxying to Apache.

However, I have not found a way for nginx to listen to multiple php sockets. It may be a headache for multithreading. Lighttpd can spawn many php processes according to /etc/lighttpd/conf.d/fastcgi.conf.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.