nginx转发端口路由器再转发

场景 nginx 转发端口 路由器二次转发了,端口不同 (shiro 或者其余一些权限控制架构会自动跳转,致使的端口不对。)html

 proxy_set_header Host $host:$proxy_port;  nginx

这个$proxy_port 写死 服务器

 

nigix作反向代理   cookie

注意  :$proxy_port  与 :$server_port 区别架构

$server_port :nigix监听的端口代理

$proxy_port : 服务器真正访问的端口server

server {htm

        listen       8888;
        server_name  192.168.1.114;        
        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        location  /a {
            proxy_pass http://127.0.0.1:8080;
            proxy_set_header Host $host:$proxy_port;
        }
        location  /b {
            proxy_pass http://192.168.1.102:8080/b;
            proxy_cookie_path /a /b;
        }

        #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;路由

        }权限控制

-----------------------------------------------------------------------------------------------------------------

server {        listen       8888;        server_name  192.168.1.114;                #charset koi8-r;        #access_log  logs/host.access.log  main;        location  /a {            proxy_pass http://127.0.0.1:8080;            proxy_set_header Host $host:$server_port;        }        location  /b {            proxy_pass http://192.168.1.102:8080/b;            proxy_cookie_path /a /b;        }        #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;        }

相关文章
相关标签/搜索