Nginx使用cgiwrap-fcgi.pl支持CGI,但频繁Resource temporarily unavailable
来源:互联网 发布:阿里云 api市场 编辑:程序博客网 时间:2024/05/22 03:14
使用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
- $socket = FCGI::OpenSocket( "/dev/shm/cgiwrap-dispatch.sock", 10 )
- ; #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
得知:
FCGI::OpenSocket(path, backlog)Creates a socket suitable to use as an argument to Request.pathPathname of socket or colon followed by local tcp port. Note that some systems take file permissions into account on Unix domain sockets, so you'll have to make sure that the server can write to the created file, by changing the umask before the call and/or changing permissions and/or group of the file afterwards.backlogMaximum length of the queue of pending connections. If a connection request arrives with the queue full the client may receive an error with an indication of ECONNREFUSED.
所以只需将FCGI::OpenSocket的第二个参数改大即可,例如
- $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
- Nginx使用cgiwrap-fcgi.pl支持CGI,但频繁Resource temporarily unavailable
- Samba & Nginx - Resource temporarily unavailable
- Nginx + PHP-FPM (11: Resource temporarily unavailable)
- 【python】Resource temporarily unavailable
- pthread_create()-------Resource temporarily unavailable
- Resource temporarily unavailable解决办法
- WSAEWOULDBLOCK: Resource temporarily unavailable
- samba---启动smaba后nginx 11 resource temporarily unavailable
- AIX:Resource temporarily unavailable解决
- semop: Resource temporarily unavailable解决方法
- -bash:fork:Resource temporarily unavailable
- 关于错误 Resource temporarily unavailable
- -1 resource temporarily unavailable
- linux: Resource temporarily unavailable 问题解决
- Resource temporarily unavailable
- Resource temporarily unavailable
- Nginx出现open() XXX failed (11: Resource temporarily unavailable)-nginx与smb之间的灵异事件
- mount error 11 Resource temporarily unavailable
- div不随滚动条左右移动而改变位置
- POJ 2689 数论
- Convert byte array to char* in a clr wrapper
- 常用的正则表达式
- iptable笔记
- Nginx使用cgiwrap-fcgi.pl支持CGI,但频繁Resource temporarily unavailable
- 终于找到阻止360文件粉碎机的源代码了
- Android library projects cannot be launched
- java new Date()字符型转yyyy-MM-dd HH:mm:ss型字符串
- 如何通过GPS获取我当前所在的城市或街道
- Android的Activity屏幕切换动画(一)-左右滑动切换
- 基于运动信息的关键帧提取
- linux系统调用
- 通过 RMAN DUPLICATE...FROM ACTIVE DATABASE创建dataguard(for oracle 11g)