1

I would like to configure Apache to act as a reverse proxy for multiple domains.

I'm having the following network configuration:

  • A router connected to the internet which forwards any incoming traffic on port 80 to a local computer where apache is installed (let's say ip 10.0.0.1)

  • The apache server is now configured to handle a domain (let's say domainA.com) and serves pages from the same computer

  • I would like to have another computer in the LAN (10.0.0.2) which runs Tomcat (also on port 80, not the normal 8080). This computer should be accessible using domainB.com.

I've seen tutorials on how to configure for multiple domains or how to configure a reverse proxy, but I have not seen them combined.

Request using domainA.com ─┬─> Router ───> Apache ─┬─> Serve domainA.com requests from the same computer (10.0.0.1)
                           │            (10.0.0.1) │
Request using domainB.com ─┘                       └─> Serve domainB.com requests from another computer in the LAN (10.0.0.2)
4

1 回答 1

1

这就是我最后使用的(相关位)

Listen 80

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

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName domainA.com
    DocumentRoot "<path to the local document root>"
</VirtualHost>

<VirtualHost *:80>
    ServerName domainB.com

    ProxyPreserveHost On
    ProxyPass / http://10.0.0.2:80/
    ProxyPassReverse / http://10.0.0.2:80/
    <Location />
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>
于 2013-07-26T08:54:39.793 回答