必须从他们自己的IP访问两个webapp(每个都专用于网络接口):
的httpd.conf :
Listen 80
Listen 443
NameVirtualHost 142.xxx.xxx.xxx:80
NameVirtualHost 143.xxx.xxx.xxx:80
# Webapp A
<VirtualHost 142.xxx.xxx.xxx:80>
ServerName ASite
DocumentRoot /mnt/data/www/html
</VirtualHost>
# Webapp B
<VirtualHost 143.xxx.xxx.xxx:80>
ServerName Bsite
ProxyPreserveHost On
ProxyRequests On
ProxyVia On
ProxyPass / http://www.siteb.com:8081/
ProxyPassReverse / http://www.siteb.com:8081/
#<Proxy *>
# Order deny,allow
# Deny from all
# Allow from 54.171.140.42
#</Proxy>
</VirtualHost>
问题:无论输入什么ip / dns来源,端点始终是站点A,除非Webapp B配置了<VirtualHost *:80>
,它将所有请求重定向(代理)到tomcat webapp B.如何映射重定向相应的?
答案 0 :(得分:0)
错误与VirtualHost指令中的IP分配有关(httpd解析为服务器的名称):
NameVirtualHost *:80
# Webapp A
<VirtualHost *:80>
ServerName ASite
DocumentRoot /mnt/data/www/html
</VirtualHost>
# Webapp B
<VirtualHost *:80>
ServerName Bsite
ProxyPreserveHost On
ProxyRequests On
ProxyVia On