Here is basically what I would like to do:
- http request comes in, portforwarding in router sends it to a server in the local network (server A)
- the server identifies the request for a virtual host
- server a has a rewrite rule for that virtual host which rewrites the request to send it to server B, which is on the same local network
- Server B gets the request, identifies a virtual host and sets the document root according to the virtual host setting
It works until server B, the request always ends up in the default definition. Is this possible at all? I'm running Debian Wheezy.
Server A apache config file /etc/apache/sites-enabled/wiki
<Directory /var/lib/shared/websites/wiki/www>
Options None
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName wiki
ServerAlias wiki.asus.local
ServerAlias wiki.mydomain.net
DocumentRoot /var/lib/shared/websites/wiki/www
CustomLog /var/lib/shared/websites/wiki/log/access.log combined
ErrorLog /var/lib/shared/websites/wiki/log/error.log
RewriteEngine on
RewriteRule ^/(.*) http://192.168.10.91/$1 [P,L]
</VirtualHost>
Server B apache config file /etc/apache/sites-enabled/wiki
<Directory /var/lib/shared/websites/wiki/www>
Options None
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName wiki
ServerAlias wiki.mydomain.net
DocumentRoot /var/lib/shared/websites/wiki/www
CustomLog /var/lib/shared/websites/wiki/log/access.log combined
ErrorLog /var/lib/shared/websites/wiki/log/error.log
</VirtualHost>
Oh and also Server B is complaining apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
on restarting apache, this has probably something to do with that, but the usual answer on that just adding ServerName localhost
to the apache.conf
can't be right in this case, all my other servers are missing the definition in the apache.conf
and none of them complains ever.
Anyone got any idea on this? Is this even possible, what I wanna do? (rewriting a virtual host and then putting request in virtual host again)
Thanks for any help!