Configure nginx. The website can only be accessed smoothly by adding a port after the domain name or IP.
淡淡烟草味
淡淡烟草味 2017-05-16 17:27:02
0
2
475

The project is deployed in tomcat.

nginx configuration:

server {
        listen       8083 ;
        server_name  域名;

        location / {

            index  index.html index.htm index.jsp;
            #proxy_redirect off;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
            proxy_pass http://127.0.0.1:8081/;
        }                       
}

It cannot be accessed directly through the domain name. After adding the 8081 port, you can access it smoothly. The direct IP port method is also available.

After just changing the domain name behind server_name to localhost, and restarting nginx, the direct domain name can be accessed, but after more than ten minutes it fails again, and I still need to add a port. Strange.

淡淡烟草味
淡淡烟草味

reply all(2)
巴扎黑

The problem has been solved because there is a firewall outside nginx, which forwards all requests through port 80 to port 8083.
After adding -A INPUT -p tcp -m tcp --dport 8083 -j ACCEPT to the firewall, you can always access the website.

曾经蜡笔没有小新

Your nginx is configured to listen on port 8083: try changing the sentence "listen 8083" to "listen 80"

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!