我在这个proxy_pass Nginx + Tomcat 7中做错了什么

时间:2019-02-21 12:28:09

标签: nginx tomcat7 proxypass

我正在尝试重定向

http://example2:8080/folder2/app/index.html#/home

https://example2.com

使用此代码:

   location / {
            try_files $uri $uri/ =404;
            proxy_pass http://127.0.0.1:8080/folder2/;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Port $server_port;
   }

我从Tomcat中获得HTTP状态404-

此Tomcat服务器上还有另一个运行正常的应用程序。这是配置:

location / {
            try_files $uri $uri/ =404;
            proxy_pass http://127.0.0.1:8080/folder1/;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Port $server_port;
}

并从以下位置重定向:

http://example1:8080/folder1/

收件人:

https://example1.com

1 个答案:

答案 0 :(得分:0)

我通过更改Tomcat URL来解决它:

http://example2:8080/folder2/app

,现在proxy_pass可以正常工作。