I have a router with port 80 forwarded to physical server "A".
On physical server "A" I have Raspbian and Apache2. Apache2 is configured for name-based virtual hosting with rewrite_module to rewrite requests for "Domain1" to physical server "B".
Physical server "B" has Crunchbang and Apache2. Apache2 is configured for name-based virtual hosting for "Domain1" and "Domain2".
"Domain1" works and "Domain2" does not work when accessing outside the lan (request through physical server "A"). It does work for both domains on the lan (with requests not going through physical server "A").
Is there a way to have mod_rewrite work for 2 name-based virtual hosts on the same physical server with 1 IP address?
(It works on more than one physical server hosting 1 name-based virtual host, but not 1 physical server hosting several virtual hosts)
Below are the configuration files on physical server "A" running Raspbian and Apache2:
/etc/apache2/apache2.conf
Code:
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
ServerName respberrypi
/etc/apache2/sites-availible/domain1
Code:
<VirtualHost *:80>
ServerName domain1.org
ServerAlias domain1.org
RewriteEngine On
RewriteRule ^(.*)$ http://domain1.org$1 [P]
</VirtualHost>
/etc/apache2/sites-availible/domain2
Code:
<VirtualHost *:80>
ServerName domain2.org
ServerAlias domain2.org
RewriteEngine On
RewriteRule ^(.*)$ http://domain2.org$1 [P]
</VirtualHost>
My /etc/hosts file has the domains pointing to the correct IP addresses.