我有1个互联网IP地址。
我有2个物理networking服务器。
1 Windows IIS7托pipe3个网站。 主机头名称在IIS7中configuration。 这工作正常,直到我添加:
1 Linux(Ubuntu lucid)Apache2托pipe1个网站。 VirtualHost在Apache2中configuration。 我遵循以下步骤: http : //ubuntu-tutorials.com/2008/01/09/setting-up-name-based-virtual-hosting/
两台服务器似乎在玩“拔河”。 这可能只是一个错误的configuration,或者是这种设置应该发生的问题?
一个可能的解决scheme是将外部IP地址提供给Ubuntu系统,并使用Apache来反向代理IIS7服务器。
为IIS服务器上的每个主机创build一个虚拟主机,例如/etc/apache2/sites-avilable/iisproxyhosts
<VirtualHost *:80> ServerName IIS.Domain1.TLD ProxyRequests Off <Proxy *> Order deny,allow allow from all </Proxy> ProxyPreserveHost On ProxyPass / http://AddressOfIIServer/ ProxyPassReverse / http://AddressOfIIServer/ </VirtualHost> <VirtualHost *:80> ServerName IIS.Domain2.TLD ProxyRequests Off <Proxy *> Order deny,allow allow from all </Proxy> ProxyPreserveHost On ProxyPass / http://AddressOfIIServer/ ProxyPassReverse / http://AddressOfIIServer/ </VirtualHost> <VirtualHost *:80> ServerName IIS.Domain3.TLD ProxyRequests Off <Proxy *> Order deny,allow allow from all </Proxy> ProxyPreserveHost On ProxyPass / http://AddressOfIIServer/ ProxyPassReverse / http://AddressOfIIServer/ </VirtualHost>
启用代理
a2enmod proxy_http a2enmod proxy
启用iisproxyhosts并retstart apache
a2ensite iisproxyhosts /etc/init.d/apache2 reload
基于名称的虚拟主机只有在所有虚拟主机在同一个Web服务器实例上运行时才起作用。 在这种情况下,您将需要使用NAT来获取networking上的两台机器,并configurationNAT盒将连接转换为非标准端口连接到其中一个盒子,或者安排其中一台networking服务器代理另一台(基于名称的虚拟主机将有助于调用代理)。 或者只是购买另一个IP地址。
这两台服务器前面的微软TMG服务器作为防火墙,可以在一个公共IP地址上托pipe多个Web URL,并使用NAT在其后面的多个主机上“反向代理”。 @geekosaur说,简单的解决scheme是获得另一个公共IP。
您可以将端口80转发到Linux上的Apache,作为Apache(非80端口)和IIS的反向代理。
它会根据请求的域名向Apache(Linux)或IIS发送请求。
你有一个公共IP的服务器,并运行Apache。现在你想要在局域网上托pipe你的应用程序,也希望他们在互联网上访问的重要组成部分是这些应用程序仍然在LAN上的机器上运行。 对于这种情况,需要一个反向代理。 以下是对这种设置的一些解释
比方说网站是:
a)internal1.example.com应映射到internal1.example.com
b)internal2.example.com应映射到internal2.example.com
c)internal3.example.com应该指向internal3。example.com
d)internal4.example.com应指向internal4。example.com
|--------------192.168.1.3 | (internal3.example.com) | |--------------192.168.1.4 | (internal4.example.com) (Public IP ) | A-------------| (reverse proxy server) | (192.168.1.25) | example.com | |--------------192.168.1.1 | (internal1.example.com) | |--------------192.168.1.2 | (internal2.example.com)
我使用Ubuntu来托pipeApache的虚拟主机定义的情况下,基于Debian的系统网站的定义是在系统A上面的图中具有公共IP
/etc/apache2/sites-enabled/internal1.conf /etc/apache2/sites-enabled/internal2.conf /etc/apache2/sites-enabled/internal3.conf /etc/apache2/sites-enabled/internal4.conf
每个这些网站的虚拟主机定义如下/etc/apache2/sites-enabled/internal1.example.conf
<virtualhost *:80> ServerAdmin webmaster@localhost ServerName internal1.example.com ProxyRequests off <proxy *> Order deny,allow Allow from all </proxy > ProxyPass / http://192.168.1.1/ ProxyPassReverse / http://192.168.1.1/ </VirtualHost >
/etc/apache2/sites-enabled/internal2.example.conf
<virtualhost *:80> ServerAdmin webmaster@localhost ServerName internal2.example.com ProxyRequests off <proxy *> Order deny,allow Allow from all </proxy > ProxyPass / http://192.168.1.2/ ProxyPassReverse / http://192.168.1.2/ </VirtualHost >
/etc/apache2/sites-enabled/internal3.example.conf
<virtualhost *:80> ServerAdmin webmaster@localhost ServerName internal3.example.com ProxyRequests off <proxy *> Order deny,allow Allow from all </proxy > ProxyPass / http://192.168.1.3/ ProxyPassReverse / http://192.168.1.3/ </VirtualHost >
/etc/apache2/sites-enabled/internal4.example.conf
<virtualhost *:80> ServerAdmin webmaster@localhost ServerName internal4.example.com ProxyRequests off <proxy *> Order deny,allow Allow from all </proxy > ProxyPass / http://192.168.1.4/ ProxyPassReverse / http://192.168.1.4/ </VirtualHost >
请注意,在所有上述虚拟主机定义中,我放弃了日志文件的选项。 因此,如果您应用于生产服务器,请将其添加到每个vhost文件中。 以上只是给你一个清楚的例子,如何可以工作。