【发布时间】:2017-01-08 23:23:19
【问题描述】:
我已经在 nginx 下配置了一个虚拟主机:
server {
listen 80;
server-tokens off;
access_log /var/log/nginx/api.example.com.access.log;
error_log /var/log/nginx/api.example.com.error.log;
index index.html index.htm;
server_name api.example.com;
autoindex on;
location / {
include uwsgi_params;
uwsgi_pass unix:/var/www/api.example.com/xxx.sock;
}
}
此文件位于sites-available 和sites-enabled 下。
我已经配置了uwsgi:
[uwsgi]
chmod-socket = 666
socket = /var/www/api.example.com/xxx.sock
processes = 5
threads = 10
master = True
module = xxx
callable = app
chdir = /var/www/api.example.com
venv = /home/xxx/.virtualenvs/xxx
thunder-lock = True
uid = www-data
gid = www-data
plugins = http,python
vhost = True
我可以让 uwsgi 和 nginx 成功启动,但是当我转到 http://api.example.com 时,我总是得到一个 nginx 404。我假设他们都通过同一个套接字进行通信,因为没有发生与之相关的错误。我还可以看到在 /var/www/api.example.com/ 和 /var/www/api.example.com/app 下生成的 .pyc 文件,我保留了我的视图和模型。
如何调试?
【问题讨论】:
标签: python nginx flask virtualenv uwsgi