嗨,我正在尝试让 nginx 和烧瓶在我的本地机器上启动并运行。
我可以用 nginx 很好地服务器静态文件,但我一直遇到 uwsgi 的连接问题。
我的 nginx:
server {
listen 80;
server_name localhost;
location /static {
alias /path/to/my/static;
autoindex on;
}
location /media {
alias /media;
autoindex on;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/tmp/uwsgi.sock;
uwsgi_param UWSGI_PYHOME /path/to/my/env;
uwsgi_param UWSGI_CHDIR /path/to/my/app;
uwsgi_param UWSGI_MODULE application;
uwsgi_param UWSGI_CALLABLE app;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
/etc/uwsgi/apps-available/uwsgi.ini:
[uwsgi]
plugins=python
vhost=true
socket=/tmp/uwsgi.sock
但是如果我尝试 localhost/,我会在 nginx 错误日志中找到:
[error] 1021#0: *16 connect() to unix:/tmp/uwsgi.sock failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:/tmp/uwsgi.sock:", host: "localhost"
我已经尝试更改权限,但我似乎无法解决这个问题。有人有什么建议吗?
任何帮助都感激不尽。