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.
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"