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)
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.
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
.