News for hackers. Stuff that matters.
Re:Nginx 1.0.0 is out by dhimes on Tuesday April 12, 2011 @07:26AM (#2436698)
Congratulations to the team indeed. I'm setting up my next project in this configuration as well and I've found nginx to be a very sweet server. I'll be serving a lot of javascript and css, but using php to handle the utility chores of accessing mysql and couchdb. Even though I'm keeping the apache back-end for this, I confess it's more out of comfort and laziness (and the rush to get it out) than because of some profound technical insight on my part.
Re:Nginx 1.0.0 is out by pilif on Tuesday April 12, 2011 @07:48AM (#2436748)
for me the reason to stay with an apache/mod_php backend was very bad experience I had with fastcgi back in the 2006/2007 area where I was using a lighttpd/fastcgi configuration.

I've seen crashes in lighty, crashes in fastcgi and subtle differences in behavior between fastcgi and mod_php.

FastCGI just wasn't a commonly used method of deployment back then, so there were for sure some bugs around that I didn't have time or interest to fix.

By now, there's PHP-FPM and fastcgi is much more common, so you could probably just hook php directly into nginx by now, but I didn't want to do experiments and I knew that apache worked, so that's what I used.

Just remember to turn off keep-alive in apache, btw.

Re:Nginx 1.0.0 is out by dhimes on Tuesday April 12, 2011 @12:47PM (#2437974)
There was a bit of chatter recently about ill-configured nginx-fastcgi servers having a php vulnerability. Seems to be summed up here:

https://nealpoole.com/blog/2011/04/setting-up-php-fastcgi-an...

Thanks for the keep-alive tip. I missed that one.

EDIT: I see that the author of the post I linked replied below- also with the link.

Re:Nginx 1.0.0 is out by chopsueyar on Tuesday April 12, 2011 @07:58AM (#2436773)
I use nginx with PHP-FPM on multiple sites and have been quite happy with the results.
Re:Nginx 1.0.0 is out by rmccue on Tuesday April 12, 2011 @08:13AM (#2436809)
I'd say it's fairly stable, as (IIRC) WordPress.com is all run off nginx.
Re:Nginx 1.0.0 is out by justincormack on Tuesday April 12, 2011 @07:44AM (#2436737)
It really is trivial to set up an fcgi process to run PHP directly from nginx.

On the nginx side, something like my config: location ~ \.php { fastcgi_index index.php; include fastcgi_params; fastcgi_pass localhost:55155; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }

Then you just need to run php in fcgi daemon mode which is built in, use php-cgi -b localhost:55155 to match that setup... more details on http://wiki.nginx.org/PHPFcgiExample

I found this much simpler than running nginx and apache...

Re:Nginx 1.0.0 is out by nbpoole on Tuesday April 12, 2011 @09:07AM (#2436981)
If you do that, you have to be very careful. I actually did a writeup about this a few days ago that I posted on HN: https://nealpoole.com/blog/2011/04/setting-up-php-fastcgi-an...

tl:dr is that the configuration you're suggesting will leave a site open to arbitrary code execution if the site allows for user uploads.

Re:Nginx 1.0.0 is out by justincormack on Tuesday April 12, 2011 @10:03AM (#2437207)
Thats not a full config, I did reference the documentation. I have a try_files line, as fcgi runs locally as it happens.
Re:Nginx 1.0.0 is out by Yaa101 on Tuesday April 12, 2011 @11:39AM (#2437652)
Just use PHP-FPM instead, it's easier and scales better. I run PHP, Django/Python and Perl without a problem at a single domain. NGINX allows to run almost anything as long as you are able to attach the socket of what you want to output towards NGINX.
Re:Nginx 1.0.0 is out by chopsueyar on Tuesday April 12, 2011 @07:59AM (#2436774)
A socket is probably faster.
Re:Nginx 1.0.0 is out by justincormack on Tuesday April 12, 2011 @08:47AM (#2436917)
Not really the bottleneck if you are running PHP. Linux optimises most of tcp out over the loopback device anyway.
Re:Nginx 1.0.0 is out by treo on Tuesday April 12, 2011 @09:52AM (#2437159)
I ran into a problem with a tcp connection to php-fpm just some weeks ago: The Server served requests at a rate of about 400req/s for some time without a single problem, until I ran out of useable ports. You won't have this problem with sockets.
Re:Nginx 1.0.0 is out by EGreg on Tuesday April 12, 2011 @11:16AM (#2437538)
Is it really a team? I thought it was just Igor Sysoev :)