2016-08-08 28 views
1

我目前正在nginx和fcgiwrap中測試perl cgi應用程序。這部分工作。不過,我在回覆中遇到了問題。nginx在使用supervisord時沒有返回fcgiwrap的錯誤

所有請求返回200.如果cgi錯誤,它只返回空白內容。

我從supervisord運行nginx和fcgiwrap。

這是我supervisord.conf文件...

[supervisord] 
logfile=/tmp/supervisord.log 
nodaemon=true 

[fcgi-program:fcgiwrap] 
command = /usr/sbin/fcgiwrap 
user = www-data 
socket = unix:///var/run/supervisor/%(program_name)s.sock 
socket_owner = www-data:www-data 
socket_mode = 0770 
autorestart=true 
autostart=true 
startsecs=1 
startretries=3 
stopsignal=QUIT 
stopwaitsecs=10 
environment=PATH='/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin' 
redirect_stderr=false 
stdout_logfile=/var/log/fcgiwrap_out.log 
stderr_logfile=/var/log/fcgiwrap_err.log 

[program:nginx] 
command=/usr/sbin/nginx -g 'daemon off;' 

我得到的出現在/var/log/fcgiwrap_err.log錯誤。但是錯誤消息,更重要的是狀態,不會返回給nginx。

這是我的nginx的配置...

server { 
    listen 80 default_server; 
    listen [::]:80 default_server; 

    root /var/www/web; 

    index index.html index.cgi; 

    server_name _; 

    location/{ 
      try_files $uri $uri/ =404; 
    } 

    location ~ \.cgi$ { 
     gzip off; 
     include /etc/nginx/fastcgi_params; 
     fastcgi_pass unix:/var/run/supervisor/fcgiwrap.sock; 
     fastcgi_index index.cgi; 
     fastcgi_param SCRIPT_FILENAME /var/www/web$fastcgi_script_name; 
    } 

    # deny access to .htaccess files 
    location ~ /\.ht { 
      deny all; 
    } 
} 

我不知道這個問題是否是由於fcgiwrap,nginx的,或supervisord的錯誤配置。

回答

0

你說supervisord監測一個套接字(/var/run/supervisor/fcgiwrap.sock),但沒有說fcgiwrap使用該套接字。 所以通過這個空套接字的PHP連接將永遠不會達到fcgiwrap進程,因此您沒有來自fcgiwrap的錯誤消息。

您需要更改fcgiwrap 命令指定使用-s參數插座,

+0

謝謝,我結束了與一個完全不同的架構,沒有使用supervisord(或碼頭),但這聽起來像這可能是問題。我可能會看到是否可以挖掘舊的源代碼並試用它。 – user1751825

相關問題