2015-12-12 24 views
0

我以前得到這個錯誤,似乎無法弄清楚爲什麼發生這種情況。Nginx的502網關錯誤:connect()unix:/home/user/project/project.sock失敗

最終它拋出502錯誤網關錯誤。

,如果我做了nginx -t,我得到:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 
nginx: configuration file /etc/nginx/nginx.conf test is successful 

它出現在我的語法: /etc/nginx/sites-enabled看起來不錯。

下面是sites-enabled網站:

server { 
    listen 80; 
    server_name <my-server-name-ip-here>; 

    error_log /home/user/project/nginx_error.error_log info; 

    root /home/user/project/projenv; 

    location/{ 
     include proxy_params; 
     proxy_pass http://unix:/home/user/project/project.sock; 
    } 

} 

錯誤即時得到:

connect() to unix:/home/user/project/project.sock failed 

這裏是我的init腳本:

start on runlevel [2345] 
stop on runlevel [!2345] 

respawn   #respawn this on reboot 
setuid user  #set as unix user 'jd' to run as 
setgid www-data #user used by nginx 

env PATH=/home/user/project/projenv/bin 
chdir /home/user/project 
exec gunicorn --workers 3 --bind unix:project.sock -m 007 wsgi:app 

任何想法,我應該怎樣解決? 謝謝!

+0

我建議檢查的'/家庭/用戶/項目的文件/ project.sock' – ajtrichards

+0

權限的權限:使用nginx的進出口srwxrwx --- 1個myuser的WWW的數據 – CodeTalk

回答

0

我建議這可能是一個權限錯誤。檢查套接字是否可由客戶端和服務器讀寫。

+0

,不是PHP5-FPM – CodeTalk

+0

哪些權限和組應該是.sock? – CodeTalk

+0

嘗試'chmod 664 sock_file_location' – ajtrichards