我有两台服务器,都运行Apache。
服务器1和2位于相同的公共IP地址。
服务器1的networkingIP为192.168.1.101
服务器2的networkingIP为192.168.1.102
example.com转到服务器1.这正是我想要的。
我希望beta.example.com/*通过Apache反向代理服务器转到服务器2。
不过,我只想要beta.example.com/*转到服务器2。
如何将Apacheconfiguration为仅使用一个子域代理服务器2?
我假设请求公共IP到server1。 您可以使用NameVirtualHost和mod_proxy模块在server1上尝试此基本configuration。
NameVirtualHost *:80 <VirtualHost *:80> ServerName beta.example.com ProxyPass / http://192.168.1.102/ ProxyPassReverse / http://192.168.1.102/ </VirtualHost> <VirtualHost *:80> ServerName example.com DocumentRoot /var/www/example </VirtualHost>