【发布时间】:2014-02-07 01:10:17
【问题描述】:
尝试在 Ubuntu 13.10 上设置 Nginx 和 uWSGI。
当我尝试访问该网站时,我得到的只是“502 Bad Gateway”。
跑apt-get install nginx uwsgi uwsgi-plugin-python3安装nginx/uwsgi。
/etc/nginx/sites-enabled/webpage.com:
server {
listen 80;
server_name webpage.com;
access_log /var/log/nginx/webpage.com_access.log;
error_log /var/log/nginx/webpage.com_error.log;
location / {
uwsgi_pass /var/run/webpage.com.uwsgi.socket;
include uwsgi_params;
uwsgi_param Host $host;
uwsgi_param X-Real-IP $remote_addr;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;
}
}
/etc/uwsgi/apps-enabled/webpage.com
[uwsgi]
vhost = true
plugin = python3
socket = /tmp/webpage.com.sock
master = true
enable-threads = true
processes = 2
home = /var/www/webpage.com/env
wsgi-file = /var/www/webpage.com/env/hello.py
virtualenv = /var/www/webpage.com/env
chdir = /var/www/webpage.com/env
touch-reload = /var/www/webpage.com/reload
/var/log/nginx/webpage.com_error.log
2014/01/17 16:28:58 [error] 25073#0: *13 connect() to unix:///var/run/webpage.com.uwsgi.socket failed (111: Connection refused) while connecting to upstream, client: 83.109.132.224, server: webpage.com, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///var/run/webpage.com.uwsgi.socket:", host: "webpage.com"
hello.py 只是一个简单的 hello world 应用程序。
已经为此苦苦挣扎了几个小时......现在我需要帮助:)
【问题讨论】:
-
很可能你的uWSGI实例没有运行,用“ps aux”检查它并检查uWSGI日志