How can I run Perl scripts using FastCGI on Nginx?

独自空忆成欢 提交于 2019-12-04 02:07:31

The webserver needs a Unix domain socket to connect to the FastCGI application, but the socket can't be created. Most likely the directory you want it to be in doesn't exist (because they are automatically created when you do a bind).

Leon is exactly correct. There are two prerequisites for allowing the socket to listen:

  1. Make sure the socket directory exists.
  2. 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.
  3. 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-cgi
spawn-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.pid
srwxr-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.pid
srwxr-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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!