首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网络技术 > 网络基础 >

Nginx施用cgiwrap-fcgi.pl支持CGI,但频繁Resource temporarily unavailable

2012-08-21 
Nginx使用cgiwrap-fcgi.pl支持CGI,但频繁Resource temporarily unavailable使用Nginx解析CGI的同学应该都

Nginx使用cgiwrap-fcgi.pl支持CGI,但频繁Resource temporarily unavailable

使用Nginx解析CGI的同学应该都看到过这个:

http://wiki.nginx.org/SimpleCGI

保存为cgiwrap-fcgi.pl后,就可以解析bash等cgi程序了


但在实际使用经常遇到如下问题:

2012/08/06 15:35:16 [error] 8483#0: *147071273 connect() to unix:/dev/shm/cgiwrap-dispatch.sock failed (11: Resource temporarily unavailable) while connecting to upstream...


原因和php-fpm遇到Resource temporarily unavailable时的原因一样,backlog设置的不够大。


解决方法:

源代码第35行左右,FCGI::OpenSocket

  1.   $socket = FCGI::OpenSocket( "/dev/shm/cgiwrap-dispatch.sock", 10 )  
  2.   ; #use UNIX sockets - user running this script must have w access to the 'nginx' folder!!

经过查询http://search.cpan.org/~skimo/FCGI-0.67/FCGI.PL

得知:

  •   $socket = FCGI::OpenSocket( "/dev/shm/cgiwrap-dispatch.sock", 1024 )  
  •   ; #use UNIX sockets - user running this script must have w access to the 'nginx' folder!!

    另外需要注意的是

    /dev/shm/cgiwrap-dispatch.sock

    这个文件的所属用户和所属组,nginx要能够对这个文件进行w操作,因此别忘了:

    chown nginx.nginx /dev/shm/cgiwrap-dispatch.sock




  • 热点排行