Linux – Is nginx good for dynamic content

apache-2.2lighttpdlinuxnginxvps

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)

Best Answer

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.