我之前遇到过这个错误,似乎无法弄清楚为什么会这样。
最终导致502 Bad Gateway错误。
如果我做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
这是我的初始化脚本:
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 :(得分:0)
我建议这可能是权限错误。检查套接字是否可由客户端和服务器读写。