/etc/nginx/sites-enabled/mysite.conf listens to port 80
server {
listen 80;
server_name localhost;
location /static {
alias /home/alps/mysite/blog/static;
}
location / {
uwsgi_pass 127.0.0.1:8001;
include /etc/nginx/uwsgi_params;
}
}
localhost:80 It will jump to the nginx default interface instead of the welcome interface of my django project
my question
1. 结果浏览器里面访问localhost:80它会自动跳转到nginx默认的欢迎界面
2. 但是如果监听8080这些端口,localhost:8080可以跳转到正确的界面
3. 请问这是怎么回事呢?我应该如何设置?
给我你的怀抱2017-05-16 17:15:02
It should be occupied by /etc/sites-enabled/default. Try removing the configuration or changing the port.
滿天的星座2017-05-16 17:15:02
Visual inspection, the configuration file is written in the wrong place?
巴扎黑2017-05-16 17:15:02
It’s because your project directory has not been written,
this parameter
root /home/www
ringa_lee2017-05-16 17:15:02
location / {
include /etc/nginx/uwsgi_params;
uwsgi_pass 127.0.0.1:8001;
uwsgi_param UWSGI_SCRIPT <__DJANGO_PROJECT__>.wsgi;
uwsgi_param UWSGI_CHDIR /<__DJANGO_HOME_DIR__>;
index index.html index.html;
client_max_body_size 35M;
}
巴扎黑2017-05-16 17:15:02
I have encountered this problem before. . Finally, it was discovered that the server's system's own nginx occupied port 80. . Just uninstall it.
You can judge like this: lsof -i:80
See which process is occupying it, then kill or uninstall it, and then start your own
黄舟2017-05-16 17:15:02
nginx.conf has a default configuration of 80. If you don’t use the default configuration, add the domain name yourself and change hosts to access.
怪我咯2017-05-16 17:15:02
Why is it you again? You’ve been working on it for a week and you haven’t succeeded yet
迷茫2017-05-16 17:15:02
Another configuration file is introduced in the configuration item
Comment out
That’s it