开发者

How Can I Proxy To Multiple Application Running in Tomcat via mod_proxy

开发者 https://www.devze.com 2023-03-01 02:47 出处:网络
I have 2 web applications running under Tomcat6.Currently, I can access one of them via m开发者_开发问答od_proxy with the following config...

I have 2 web applications running under Tomcat6. Currently, I can access one of them via m开发者_开发问答od_proxy with the following config...

<VirtualHost xxx.xxx.xxx.xxx:80>
     ServerAdmin email@email.com
     ServerName staging.domain.com

     ProxyPass /app1 http://localhost:8080/app1
     ProxyPassReverse /app1 http://localhost:8080/app1
</VirtualHost>

Now, I can access app1 via http://staging.domain.com/app1. I also want to be able to access app2 the same way: http://staging.domain.com/app2. I configured a second VirtualHost however, only the first one works. Is this even possible, to proxy 2 web apps under a single domain? If so, any hints, tips, tricks would be greatly appreciated.


Ah, you're already pretty much doing it: just add extra ProxyPass/ProxyPassReverse statements.

<VirtualHost xxx.xxx.xxx.xxx:80>
     ServerAdmin email@email.com
     ServerName staging.domain.com

     ProxyPass /app1 http://localhost:8080/app1
     ProxyPassReverse /app1 http://localhost:8080/app1

     ProxyPass /app2 http://localhost:8080/app2
     ProxyPassReverse /app2 http://localhost:8080/app2

     ProxyPass /app3 http://localhost:8080/app3
     ProxyPassReverse /app3 http://localhost:8080/app3
</VirtualHost>
0

精彩评论

暂无评论...
验证码 换一张
取 消