我似乎无法使这个nginx配置在端口80上工作。我尝试使用nginx和gunicorn部署django应用程序。我使用以下命令运行gunicorn:
gunicorn myproj.wsgi:application --bind=127.0.0.1:8001 --workers=9下面是nginx配置文件/etc/nginx/sites-enabled/myproj
server {
listen 8080;
location / {
proxy_pass http://127.0.0.1:8001;
}
location /static/ {
root /webapps/myproj/;
}
}除了我必须在本地输入http://localhost:8080/或http://xxx.xxx.xxx:8080/,应用程序才能正确运行外,一切正常。如果没有端口号8080,将找不到该页。
但是,如果我在配置文件( listen 8080; )中将listen 80;更改为listen 80;,并在本地或远程输入http://localhost/或http://xxx.xxx.xxx/,则该页面只显示来自nginx的欢迎消息。Nginx似乎没有将请求转发给我的应用程序。问题出在哪里?
发布于 2014-12-10 10:44:17
您需要指定要绑定到的域或IP。
listen XXX.XXX.XXX:80;发布于 2014-12-10 21:00:51
可能是因为有listen 80;的其他服务器存在。
您可以删除其他服务器防御。或者将listen 80;更改为listen 80 default_server;。或者对基于名称的进程使用server_name指令。
了解nginx如何决定哪个服务器应该处理请求:processing.html
https://stackoverflow.com/questions/27398631
复制相似问题