I have been trying to deploy a demo app with this tutorial. I am doing this on a CentOS 7 in Virtualbox.
However, I am getting 502 Bad Gateway
. How can I fix this?
server {} block in nginx.conf file
server {
listen 80;
server_name 172.16.16.215;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/michel/myproject;
}
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://unix:/home/michel/myproject/myproject.sock;
}
}
gunicorn.service file
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=michel
Group=nginx
WorkingDirectory=/home/michel/myproject
ExecStart=/home/michel/myproject/myprojectenv/bin/gunicorn --workers 3 --bind unix:/home/michel/myproject/myproject.sock myproject.wsgi:application
[Install]
WantedBy=multi-user.target
var/logs/nginx/error.log
2016/08/28 18:55:14 [crit] 17557#0: *4 connect() to unix:/home/michel/myproject/myproject.sock failed (13: Permission denied) while connecting to upstream, client: 172.16.16.23, server: 172.16.16.217, request: "GET / HTTP/1.1", upstream: "http://unix:/home/michel/myproject/myproject.sock:/", host: "172.16.16.217"