(fast)cgi and nginx - there has to be a better way

Phillip B Oldham phill at theactivitypeople.co.uk
Mon Sep 29 16:15:25 MSD 2008

Jonathan Vanasco wrote:
> running php via fcgi is a PITA, and most ways involve using lighttpd's 
> fcgi manager
Sorry for the late reply... I've been away.

PHP via FastCGI is easy. Just execute `php-cgi -b /tmp/php.socket &` 
from the command-line, and its running in FastCGI mode. `export 
PHP_FCGI_CHILDREN=X` to set the number of child processes before-hand, 
if you need to. I've written a small init script to handle this for me.

Then tell nginx to fastcgi_pass to the socket: fastcgi_pass 

I'm running this set-up on 3 production servers with no problem.

Going down the route of using lighty's spawn-fcgi caused no end of 
problems for me. It seems as though the spawn-fcgi binary introduces 
some type of race-condition when passing requests to PHP, causing 
nginx/lighty to loose connections.
> trying to get a fcgi compatible perl app ( like Movable Type ) or a 
> python app is 10x more of a hassle
Isn't it just a case of telling the app to listen on a socket and then 
pointing nginx to that socket?
> not supporting cgi makes sense, but the barrier to using fcgi with 
> nginx is 'really fucking high' right now.
Do we really need the obscenities?

I think mike knocked up a small SCGI module after I put in a request. 
Not sure if anyone in the community is testing/using it, but maybe that 
could be a starting point for your issues if FastCGI isn't a solution?


*Phillip B Oldham*
The Activity People
phill at theactivitypeople.co.uk <mailto:phill at theactivitypeople.co.uk>



This e-mail and its attachments are intended for the above named 
recipient(s) only and may be confidential. If they have come to you in 
error, please reply to this e-mail and highlight the error. No action 
should be taken regarding content, nor must you copy or show them to anyone.

This e-mail has been created in the knowledge that Internet e-mail is 
not a 100% secure communications medium, and we have taken steps to 
ensure that this e-mail and attachments are free from any virus. We must 
advise that in keeping with good computing practice the recipient should 
ensure they are completely virus free, and that you understand and 
observe the lack of security when e-mailing us.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: phill.vcf
Type: text/x-vcard
Size: 261 bytes
Desc: not available
URL: <http://nginx.org/pipermail/nginx/attachments/20080929/1b1d07db/attachment.vcf>

More information about the nginx mailing list