简体   繁体   English

如何在Nginx上使用FastCGI运行Perl脚本?

[英]How can I run Perl scripts using FastCGI on Nginx?

So I am following this guide: http://technotes.1000lines.net/?p=23 and I am going through the steps. 所以我遵循这个指南: http//technotes.1000lines.net/?p = 23我正在完成这些步骤。 I have a VPN (slicehost.com) with Debian Etch, serving a website (static so far) with nginx. 我有一个使用Debian Etch的VPN(slicehost.com),用nginx为一个网站(静态到目前为止)提供服务。 I used wget to download FastCGI and I did the usual make make install routine. 我使用wget下载FastCGI,我做了通常的make make install例程。

So I guess since FastCGI can't normally run CGI scripts you have to use some type of perl wrapper to interpret the perl. 所以我想因为FastCGI无法正常运行CGI脚本,所以你必须使用某种类型的perl包装来解释perl。

Now I run this script 现在我运行这个脚本

http://technotes.1000lines.net/fastcgi-wrapper.pl http://technotes.1000lines.net/fastcgi-wrapper.pl

and I run into the exact same problem that a person ran into on the page that the script was submitted: 我遇到了一个人在提交脚本的页面上遇到的完全相同的问题:

http://www.ruby-forum.com/topic/145858 http://www.ruby-forum.com/topic/145858

(I'm not a ruby person and there is nothing ruby oriented in there) (我不是一个红宝石人,那里没有任何红宝石定向)

I keep getting a 我一直在接受

# bind/listen: No such file or directory

And I have no idea how to proceed. 我不知道如何继续。 I would appreciate any help and I can give any more details that anyone would need. 我很感激任何帮助,我可以提供任何人需要的更多细节。

The webserver needs a Unix domain socket to connect to the FastCGI application, but the socket can't be created. Web服务器需要一个Unix域套接字才能连接到FastCGI应用程序,但无法创建套接字。 Most likely the directory you want it to be in doesn't exist (because they are automatically created when you do a bind ). 很可能您希望它所在的目录不存在(因为它们是在您执行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. 这在fastcgi-wrapper.pl脚本中定义为/var/run/nginx/perl_cgi-dispatch.sock。 Therefore, you will need to make sure /var/run/nginx exists. 因此,您需要确保/ var / run / nginx存在。
  3. Make sure the socket directory is owned by the same user that the fastcgi-wrapper.pl is being executed as. 确保套接字目录由执行fastcgi-wrapper.pl的同一用户所有。

I'm gonna try and "water down" fastcgi-wrapper.pl, so it can be used with spawn-fcgi . 我要尝试“淡化”fastcgi-wrapper.pl,这样它就可以和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: 在/ var / run里面我有:

-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. 我可以轻松地启动和停止FastCGI包装器,我也想用Perl来做。

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. 如果有人已经有一个与spawn-fcgi一起使用的脚本,我很乐意使用它,或者至少看看它。

Cheers, --polemon 干杯, - 波尔蒙

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在per中运行perl和ruby脚本作为任务? - How can I run perl and ruby scripts as tasks in ant? 如何使用Epic在项目中导入perl脚本? - How can I import perl scripts in a project using Epic? 如何编写支持CGI,FastCGI和mod_perl的Perl Web应用程序? - How can I write a Perl web app that supports CGI, FastCGI and mod_perl? 如何将 Perl 代码从 mod_perl 移植到 FastCGI? - How can I port Perl code from mod_perl to FastCGI? 如何获得这些Perl脚本来延迟? - How can I get these Perl scripts to delay? 为什么我们不能使用python服务器(即simpleHTTPServer)运行perl cgi-script? - why can't we run perl cgi-scripts using python server i.e simpleHTTPServer? 如何在 perl 中运行多个测试脚本并提供另一个测试脚本的参数? - How can I run multiple tests scripts in perl giving parameters from another one? 如何在Windows上运行多个Perl脚本而不打开单独的命令窗口? - How can I run multiple Perl scripts on Windows without opening separate command windows? 如何正确运行 Perl“one liner”命令行脚本? - How can I properly run Perl "one liner" command line scripts? 如何避免在Apache 1.3下运行的Perl CGI脚本中的僵尸? - How can I avoid zombies in Perl CGI scripts run under Apache 1.3?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM