How can I run Perl scripts using FastCGI on Nginx?
Leon is exactly correct. There are two prerequisites for allowing the socket to listen:
- Make sure the socket directory exists. This is defined in the fastcgi-wrapper.pl script as /var/run/nginx/perl_cgi-dispatch.sock. Therefore, you will need to make sure /var/run/nginx exists.
- Make sure the socket directory is owned by the same user that the fastcgi-wrapper.pl is being executed as.
I'm gonna try and "water down" fastcgi-wrapper.pl, so it can be used with spawn-fcgi.
I use two of those sockets allready:
spawn-fcgi -C 3 -u www-data -s /var/run/php-fcgi.sock -P /var/run/php-fcgi.pid -- /usr/bin/php5-cgispawn-fcgi -F 3 -u www-data -s /var/run/lua-fcgi.sock -P /var/run/lua-fcgi.pid -- /usr/bin/wsapi.fcgi
Inside /var/run I have:
-rw-r--r-- 1 root root 14 2010-08-07 12:14 /var/run/lua-fcgi.pidsrwxr-xr-x 1 www-data www-data 0 2010-08-07 12:14 /var/run/lua-fcgi.sock=-rw-r--r-- 1 root root 4 2010-08-07 12:14 /var/run/php-fcgi.pidsrwxr-xr-x 1 www-data www-data 0 2010-08-07 12:14 /var/run/php-fcgi.sock=
I can easily start and stop the FastCGI wrappers, and I want to do that with Perl too.
If anyone has already a script, that works with spawn-fcgi, I'd be happt to use that, or at least have a look at it.
Cheers,--polemon