San*_*der 1 iis reverse-proxy windows-server-2008-r2 apache-2.2
在我的地方,我有 4 台服务器,每台都运行 Win2008r2-WEB,作为网络服务器运行所有不同类型的服务器(TomCat、IIS、Apache、ZendServer),每台服务器也有不同的 IP 地址(10.0.0.0/24)
有没有办法根据主机名将流量路由到每台服务器?(例如:apache.domain.org、iis.domain.org、tomcat.domain.org、zend.domain.org)
显然,我无法将 A 记录更改为内部 IP,并且我无权更改端口。
同样由于代理原因,我不能只使用其他端口,我只能访问 :80 传入。
要使其工作,您需要做的是将单个现有 Web 服务器(或专用于该任务的单独服务器)配置为反向代理。
它将负责在公共地址上获取请求并读取主机标头,然后根据请求的主机将请求代理到适当的私有地址。
用于此任务的流行软件包是 Apache(您可以使用现有实例)、nginx 或 HAProxy。这里有很多关于适当配置这些问题的信息(“反向代理”是可以让您到达那里的搜索词),但是如果您考虑了这些软件包中的特定一个,那么我可以使用示例编辑此答案配置。
编辑:示例 Apache 配置:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName apache.domain.org
ServerAlias www.apache.domain.org
# For this one, we'll imagine that you want to serve these resources from
# the local server. If you want do use a separate Apache instance instead,
# then copy one of the other hosts for this one.
DocumentRoot "C:\path\to\site\files"
<Directory "C:\path\to\site\files">
Order allow,deny
Allow from all
</Directory>
# Any other directives you need for the content here
</VirtualHost>
<VirtualHost *:80>
ServerName iis.domain.org
ServerAlias www.iis.domain.org
# Replace the URL below with the URL of the IIS server - make sure
# to keep the trailing slash.
ProxyPass / http://10.x.x.1:80/
ProxyPassReverse / http://10.x.x.1:80/
</VirtualHost>
<VirtualHost *:80>
ServerName tomcat.domain.org
ServerAlias www.tomcat.domain.org
# Replace the URL below with the URL of the Tomcat server - make sure
# to keep the trailing slash.
ProxyPass / http://10.x.x.2:8080/
ProxyPassReverse / http://10.x.x.2:8080/
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1842 次 |
| 最近记录: |