After nginx port mapping, the jump takes the internal network port instead of the external network port.

For example: you want to map 192.168.1.10:90 to the external network to 10.1.1.10:91, but after the login jump, the address becomes 10.1.1.10:90

Solution: This is because nginx has done port redirection. You only need to add: port_in_redirect off; in the http or server of the nginx.conf configuration file; and specify the external network port to jump to, you can solve this problem, as shown below:

server {

        listen     90;

charset UTF-8;

        server_name 192.168.1.10;

   location / {

        proxy_pass http://192.168.1.10:81/;

        port_in_redirect off;

        proxy_set_header   Host    $host:91;

        proxy_set_header   Remote_Addr    $remote_addr;

        proxy_set_header   X-Real-IP    $remote_addr;

        proxy_set_header   X-Forwarded-For    $proxy_add_x_forwarded_for;

        proxy_set_header   X-Forwarded-For    $remote_addr;

         index index;

        }

}

Guess you like

Origin blog.csdn.net/weixin_42272246/article/details/128134903
Recommended