0

I have two webservers on my local nework:

192.168.1.1 -> main apache2 192.168.1.2 -> secondary apache2

all http requests come in on port 80 to .1 how can I create a virtual host setting to redirect a subdomain (say lights.example.com) to the server at .2?

Right now I have this:

<VirtualHost *:80>
        ServerName lights.example.com
        RewriteEngine     On
        RewriteRule       ^(.*)$        http://192.168.1.2$1  [P]
</VirtualHost>

but when I browse to lights.example.com I get an 403:

You don't have permission to access / on this server.

from my primary server, but browsing directly to my secondary works fine.

Thanks! Nat

0

1 Answer 1

1

We use apache to "proxy" the requests instead. This may be of use?

<VirtualHost *:80>
 ServerAdmin [email protected]
 ServerName application.test.example.com
    # if not specified, the global error log is used
 ErrorLog /var/log/apache2/application.error.log
 CustomLog /var/log/apache2/application.access.log combined

 HostnameLookups Off
 UseCanonicalName On
 ServerSignature On

 ProxyPass / http://forwardedserver.internal/
 ProxyPassReverse / http://forwardedserver.internal/
</VirtualHost>

Not the answer you're looking for? Browse other questions tagged .