我使用的是linux fedora,我将nginx安装为sudo yum install nginx
.我创建了一个 django 项目并将端口指定为 guicorn projectname.wsgi:application --bind=127.0.0.1:8001
.我在 /etc/nginx/sites-enabled/default
创建了一个文件
在我的default
文件我有以下代码:
server {
listen localhost:8006;
location / {
proxy_pass http://127.0.0.1:8001;
}
location /static/ {
autoindex on;
alias /home/user/Desktop/projects/28-05-2014/HMS/static/;
}
}
当我检查我的 nginx 服务器主页为 localhost:80
时它正在运行。但是当我调用localhost:8006
时它没有连接。当我用 netstat -lnt | grep 80
检查事件连接时我发现只有 nginx 默认服务正在运行。我犯了什么错误。如有任何帮助,我们将不胜感激
最佳答案
将上述代码放入位于 /etc/nginx/
的 nginx.conf
文件中。然后你的配置文件如下所示
nginx.conf
server {
listen localhost:8006;
location / {
proxy_pass http://127.0.0.1:8001;
}
location /static/ {
autoindex on;
alias /home/user/Desktop/projects/28-05-2014/HMS/static/;
}
}
关于python - 为什么 nginx 没有启动我的服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23909798/