2012-10-08 70 views

回答

1

我假設,既然你提到你正在使用mod_rewrite,你是面向Tomcat的Apache? 如果是這樣,爲什麼不使用Apache作爲反向代理?

Apache的配置示例如下:Tomcat假定在端口8080上運行,Tomcat的ROOT上下文服務於應用程序。

NameVirtualHost * 
<VirtualHost *> 
    ServerName url1.com 
    ProxyRequests Off 
    <Proxy *> 
     Order deny,allow 
     Allow from all 
    </Proxy> 

    ProxyPass/http://localhost:8080/ 
    ProxyPassReverse/http://localhost:8080/ 

    <Location /> 
     Order allow,deny 
     Allow from all 
    </Location> 
</VirtualHost> 

<VirtualHost *> 
    ServerName url2.com 
    ProxyRequests Off 
    <Proxy *> 
     Order deny,allow 
     Allow from all 
    </Proxy> 

    ProxyPass/http://localhost:8080/ 
    ProxyPassReverse/http://localhost:8080/ 

    <Location /> 
     Order allow,deny 
     Allow from all 
    </Location> 
</VirtualHost>  
相關問題