[英]Django - Gunicorn/Nginx - 502 Bad Gateway
在502 Bad Gateway ngnix / 1.10.3上需要帮助
我已经使用Nginx / Gunicorn配置了Django应用程序。 在我对代码进行一些更改并重新加载服务器之前,它运行良好。
仅供参考:我的settings.py具有ALLOWED_HOSTS = ['*']
错误日志:
2018/06/27 08:36:38 [crit] 7444#7444: *35 connect() to unix://home/ubuntu/www/MySite/MySite.sock failed (13: Permission denied) while connecting to upstream, client: 106.51.16.0, server: 18.191.255.247, request: "GET /report/ HTTP/1.1", upstream: "http://unix://home/ubuntu/www/MySite/MySite.sock:/report/", host: "18.191.255.247"
2018/06/27 08:36:40 [crit] 7444#7444: *35 connect() to unix://home/ubuntu/www/MySite/MySite.sock failed (13: Permission denied) while connecting to upstream, client: 106.51.16.0, server: 18.191.255.247, request: "GET /report/ HTTP/1.1", upstream: "http://unix://home/ubuntu/www/MySite/MySite.sock:/report/", host: "18.191.255.247"
2018/06/27 08:36:41 [crit] 7444#7444: *35 connect() to unix://home/ubuntu/www/MySite/MySite.sock failed (13: Permission denied) while connecting to upstream, client: 106.51.16.0, server: 18.191.255.247, request: "GET /report/ HTTP/1.1", upstream: "http://unix://home/ubuntu/www/MySite/MySite.sock:/report/", host: "18.191.255.247"
2018/06/27 08:39:06 [crit] 7444#7444: *41 connect() to unix://home/ubuntu/www/MySite/MySite.sock failed (13: Permission denied) while connecting to upstream, client: 106.51.16.0, server: 18.191.255.247, request: "GET /report/ HTTP/1.1", upstream: "http://unix://home/ubuntu/www/MySite/MySite.sock:/report/", host: "18.191.255.247"
更新1:
这是我的Nginx配置。 这有什么问题吗?
在/ etc / nginx的/网站可用/ mysite的
server {
listen 80;
server_name 18.191.255.247;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/ubuntu/www/MySite;
}
location / {
include proxy_params;
proxy_pass http://unix://home/ubuntu/www/MySite/MySite.sock;
}
}
我如何验证Nginx守护程序对项目文件夹的权限(// unix:// home / ubuntu / www / MySite)
尝试将代理传递URL手动设置为在服务器上运行项目的端口gunicorn,如下所示:
location / {
proxy_pass http://localhost:8000;
proxy_redirect off;
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_connect_timeout 500;
proxy_read_timeout 600;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.