Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用tomcat的Nginx多域和多应用程序_Tomcat_Nginx - Fatal编程技术网

使用tomcat的Nginx多域和多应用程序

使用tomcat的Nginx多域和多应用程序,tomcat,nginx,Tomcat,Nginx,我正在尝试使用一台nignx服务器代理在tomcat中运行的多个应用程序: a.example.com ->192.168.1.101:8080/ps and 192.168.1.102:8080/ps b.example.com ->192.168.1.102:9080/ir 这是我的nginx.conf。它似乎不起作用。请帮助我。谢谢 upstream ps { server 192.168.1.101:8080 weight=2; server 192.168

我正在尝试使用一台nignx服务器代理在tomcat中运行的多个应用程序:

a.example.com ->192.168.1.101:8080/ps and 192.168.1.102:8080/ps
b.example.com ->192.168.1.102:9080/ir
这是我的nginx.conf。它似乎不起作用。请帮助我。谢谢

upstream ps {
    server 192.168.1.101:8080 weight=2;
    server 192.168.1.102:8080 weight=3;
    }

  upstream ir {
        server 192.168.1.102:9080;
    }
server {
        listen       80;
        server_name  a.example.com;
        location /{
        proxy_pass http://ps/ps;
        }
    }
    server{
        listen  80;
        server_name b.example.com;
        location /{
            proxy_pass http://ir/ir;
        }
    }

有什么问题吗?可能您错过了proxy_pass.problecm is:a.example.com中的尾随斜杠,它只代理到192.168.1.101:8080,但不代理到ps appIt应使用此配置。您是如何检查的?此配置不起作用。我认为‘代理通行证’这是错误的。它应该这样写“proxy\u通过tomcat将应用程序设置为默认值。然后一切都好了。我只是不喜欢这种方式。你试过添加尾部斜杠吗?在当前配置中,对a.example.com/test/path的请求将被代理为192.168.1.101:8080/pstest/path。我很确定那不是你想要的。