Nginx cannot be accessed through domain name: 80, but everything else is OK. What is the reason?
怪我咯
怪我咯 2017-05-16 17:26:10
0
5
938
server {

        listen   80;
        server_name foo.bar.com;
        access_log /www/logs/access.log;
        error_log /www/logs/error.log;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
         include        uwsgi_params;
         uwsgi_pass     127.0.0.1:8077;
        }

        error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        location /static/ {
            alias  /www/app/my_site/static/;
            index  index.html index.htm;
        }

        location /media/ {
            alias  /www/app/media/;
        }
    }

The above is the configuration file. If you change 80 to 8001, you can access it. Or you can access it directly through IP without modifying 80.
Only the combination of domain name: 80 cannot be accessed. There is no error message.
What could be the reason?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(5)
Ty80

In UNIX systems, ports below 1024 require root privileges to monitor. Have you not added sudo during startup?

Also, have you added 127.0.0.1 foo.bar.com to hosts?

大家讲道理

You are visiting 域名:80 的时候,难道浏览器不会自动把 :80 帮你去掉吗?按理说,80 It is the default product of common HTTP services, and the browser will automatically handle it.

You can access this configuration directly foo.bar.com 就可以了,不需要再加 :80. When you access directly through IP, you are accessing the default configuration of Nginx listening on port 80.

洪涛

nginx.conf or other vhost conf files have restricted IP access
For example:
server {
listen 80 default;
server_name _;
server_name www.example.com example.com
return 500;
}

習慣沉默

nmap foo.bar.com to see if your foo.bar.com is the IP of your VPS. By the way, check if port 80 has been monitored. Oh, there may also be issues such as filing. . .

大家讲道理

You can check whether it is a filing issue. Agreed RobinTang. (Can’t agree yet...)
121.222.208.43 - - [time] "-" 400 0 "-" "-"
400 Bad request.
The access is broken before it reaches Nginx. Combined with the availability of other ports, it is likely to be a filing issue. (Maybe only 80,443 is not useful?)
I have purchased foreign VPS and domain names and have never encountered this problem.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template