django - nginx cannot use port 80 (it will automatically jump to the welcome interface of nginx), other ports can be used
ringa_lee
ringa_lee 2017-05-16 17:13:02
0
9
566

/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. 请问这是怎么回事呢?我应该如何设置?
ringa_lee
ringa_lee

ringa_lee

reply all(9)
给我你的怀抱

It should be occupied by /etc/sites-enabled/default. Try removing the configuration or changing the port.

滿天的星座

Visual inspection, the configuration file is written in the wrong place?

巴扎黑

It’s because your project directory has not been written,
this parameter

root /home/www
左手右手慢动作
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;
}
伊谢尔伦

Has nginx been restarted?

巴扎黑

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

黄舟

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.

刘奇

Why is it you again? You’ve been working on it for a week and you haven’t succeeded yet

迷茫

Another configuration file is introduced in the configuration item

include /etc/nginx/conf.d/*.conf;

Comment out

That’s it

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!