我正在研究如何在 Ubuntu 16.04 上使用 uWSGI 和 Nginx 服务 Django 应用程序。
我已经完成了 tut 并重新启动了 nginx 和 uwsgi。我注意到,如果我访问服务器的 IP,我会看到我的站点(让我认为 uwsgi 工作正常)。但是,如果我转到www.mysite.com
,则会收到 502 错误。在我的nginx的配置文件/etc/nginx/sites-available
是mysite
包含:
server {
listen 80;
server_name mysite.com www.mysite.com;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/deploy/mysite;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/mysite.sock;
}
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
$ systemctl status uwsgi
Failed to connect to bus: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我很困惑,我知道我一直在处理一些 uwsgi 文件和
$ sudo systemctl start uwsgi
Run Code Online (Sandbox Code Playgroud)
不会导致错误。此外,该网站仍在 IP 地址上提供服务。我以为 uwsgi 正在这样做。
$ netstat -a|grep uwsgi
unix 2 [ ACC ] STREAM LISTENING 2373238691 /run/uwsgi/mysite.sock
Run Code Online (Sandbox Code Playgroud)
Shi*_*tya 18
502 Bad Gateway 错误意味着服务器没有从另一台服务器得到正确的响应。在您的情况下,它是uWSGI
服务器。由于错误,它没有运行或停止。
使用sudo systemctl status uwsgi
.检查 uWSGI 服务器的状态。
归档时间: |
|
查看次数: |
72663 次 |
最近记录: |