我正在关注http://www.obeythetestinggoat.com/book/chapter_08.html http://www.obeythetestinggoat.com/book/chapter_08.html书上说要添加一个unix套接字来使用gunicorn运行nginx服务器,我就是这么做的。
这是我的 nginx 文件
server {
listen 80;
server_name mydjsuperlist-staging.tk;
location /static {
alias /home/elspeth/sites/mydjsuperlist-staging.tk/static;
}
location / {
proxy_set_header Host $host;
proxy_pass http://unix:/tmp/mydjsuperlist-staging.tk.socket;
}
}
Nginx 重新加载,没有任何失败,并使用 nginx -t 检查它
当我跑步时:
gunicorn --bind unix:/tmp/mydjsuperlist-staging.tk.socket superlists.wsgi:application
它在 tmp 文件夹中成功创建了 mydj superlist-staging.to.socket 文件,我在终端上得到了这个文件
2016-09-01 18:56:01 [15449] [INFO] Starting gunicorn 18.0
2016-09-01 18:56:01 [15449] [INFO] Listening at: unix:/tmp/mydjsuperlist-staging.tk.socket (15449)
2016-09-01 18:56:01 [15449] [INFO] Using worker: sync
2016-09-01 18:56:01 [15452] [INFO] Booting worker with pid: 15452
一切看起来都很好,但是当我访问我的网站 mydjsuperlist-staging.tk 时,它给出了 (502) bad gateway 错误。
当我使用端口时,我的网站运行完美。我在这里做错了什么?
将您的套接字文件放入/var/run代替/tmp
不客气。
这个答案花了我两个小时,fml...
我找到它在https://serverfault.com/questions/463993/nginx-unix-domain-socket-error/464025#464025 https://serverfault.com/questions/463993/nginx-unix-domain-socket-error/464025#464025
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)