I've gotten this error before, and can't seem to figure out why this occurred.
Ultimately its throwing a 502 Bad Gateway error.
if I do a nginx -t
, I get:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
It appears my syntax in:
/etc/nginx/sites-enabled
looks good.
Here's the site in 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;
}
}
Error Im getting:
connect() to unix:/home/user/project/project.sock failed
Here's my init script:
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
any idea what I should fix?? Thank you!
I'd suggest that this is probably a permissions error. Check that the socket is readable and writable by both client and server.