HTTP Server Multiplexer/Tunneler(Proxy)

和自甴很熟 提交于 2020-01-07 04:35:02

问题


I'm looking for a HTTP Server Multiplexer because I've only one public IP and I need use two different Web Servers (Tomcat and IIS) on the same port (the 80). So I thought that is possible use a multiplexer to tunnel all traffic for iis.mydomain.com to the internal port of IIS (for example the 81) and tunnel all the traffic for apache.mydomain.com to the internal port of Tomcat (for example 82).

I think the multpliplexer must choose the correct tunnel reading the HTTP-Host header. And this way makes all transparent to the internet browser, because I use tunnels, not redirects.

Am I wrong? Is there an existing software for Windows?


回答1:


First you have to install mod_proxy & mod-rewrite.on windows or many linux ditributions these modules are installed by default, so you may found them on C:\Program Files\Apache Software Foundation\Apache2.2\modules in windows and /usr/lib/apache2/modules in linux.

so you need to load them via apache config:

unix-like os:

LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

windows:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so

then configure two virtual hosts on your apache:

Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
        ServerName iis.mydomain.com
        RewriteEngine on
        RewriteRule ^/(.*)$ http://localhost:81/$1 [P]    
</VirtualHost>

<VirtualHost *:80>
        ServerName apache.mydomain.com
        RewriteEngine on
        RewriteRule ^/(.*)$ http://localhost:82/$1 [P]    
</VirtualHost>

for more information please see here and here

EDIT 1:

An article about using apache on windows



来源:https://stackoverflow.com/questions/16725077/http-server-multiplexer-tunnelerproxy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!