NGINX无法重写网址

时间:2015-09-05 09:54:15

标签: nginx

我有一个名为RB-war完整路径的java web应用程序是localhost:8080 / RB-war但是我将url更改为localhost / Admin但是我无法改变这一点,首先重定向是正确的但当我点击链接时在这个项目上,它找不到或完全重定向。

 location /RB-war {
    access_by_lua '
     ngx.log(ngx.NOTICE,"Reverse Proxy12 :",ngx.var.args)
    ';
    proxy_pass http://192.168.10.72:8080$uri;
    #rewrite http://192.168.10.72:8080/RB-war/* http://192.168.10.72:8080/Admin/$1; 
    proxy_redirect https://192.168.10.72:8080/RB-war https://192.168.10.72:8080/Admin;
}

location /Admin {
    access_by_lua '
     ngx.log(ngx.NOTICE,"Proxy :",ngx.var.args);
    ';
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header target  $host;
    port_in_redirect on;
    proxy_pass http://192.168.10.72:8080/RB-war/; 
    proxy_redirect default;     
    #proxy_redirect https://192.168.10.72:8080/RB-war/ https://192.168.10.72:8080/Admin/;
}

0 个答案:

没有答案