Nginx使用cgiwrap-fcgi.pl支援CGI,但頻繁Resource temporarily unavaila

來源:互聯網
上載者:User


Nginx使用cgiwrap-fcgi.pl支援CGI,但頻繁Resource temporarily unavailable的問題 使用Nginx解析CGI的同學應該都看到過這個: http://wiki.nginx.org/SimpleCGI儲存為cgiwrap-fcgi.pl後,就可以解析bash等cgi程式了  www.2cto.com  但在實際使用經常遇到如下問題: 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!!  www.2cto.com  經過查詢http://search.cpan.org/~skimo/FCGI-0.67/FCGI.PL 得知:[php] FCGI::OpenSocket(path, backlog)  Creates a socket suitable to use as an argument to Request.    path  Pathname 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.    backlog  Maximum 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.    www.2cto.com  所以只需將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  作者 Liv2005

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.