LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache Internal Server Redirection vhost => vhost not working [Debian & Apache 2] (https://www.linuxquestions.org/questions/linux-server-73/apache-internal-server-redirection-vhost-%3D-vhost-not-working-%5Bdebian-and-apache-2%5D-4175463490/)

Smokin... 05-26-2013 08:50 AM

Apache Internal Server Redirection vhost => vhost not working [Debian & Apache 2]
 
Hi

Any help anyone can give me on this problem, detailed below, would be greatly appreciated.

Kind regards
Nick Adie

I have a Public [82.x.x.x] and Private Apache Servers [192.168.20.100], and wish to redirect a series of subdomain requests i.e. for joomla.example.com or moodle.example.com on 82.x.x.x => joomla.example.com or moodle.example.com on 192.168.20.100.

joomla.example.com [82.x.x.x] returns joomla.example.com [192.168.20.100] :)

moodle.example.com [82.x.x.x] however returns joomla.example.com [192.168.20.100] :(

VHOST Configuration on [82.x.x.x]:

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

----------

VHOST Configuration on [192.168.20.100]

<VirtualHost *:80>
# joomla.example.com>
ServerName joomla.example.com
ServerAlias joomla.example.com
DocumentRoot /var/www/joomla/
ServerRoot /var/www/joomla/
ScriptAlias /cgi-bin/ /var/www/~cgi-bin/joomla/
ErrorLog /var/www/~log/joomla/error.log
CustomLog /var/www/~log/joomla/access.log combined
ErrorDocument 404 /404.htm

<Directory /var/www/joomla>
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
#Order allow,deny
#Allow from all
</Directory>

</VirtualHost>

<VirtualHost *:80>
# moodle.example.com>
ServerName moodle.example.com
ServerAlias moodle.example.com
DocumentRoot /var/www/moodle/
ServerRoot /var/www/moodle/
ScriptAlias /cgi-bin/ /var/www/~cgi-bin/moodle/
ErrorLog /var/www/~log/moodle/error.log
CustomLog /var/www/~log/moodle/access.log combined
ErrorDocument 404 /404.htm

<Directory /var/www/moodle>
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
#Order allow,deny
#Allow from all
</Directory>

</VirtualHost>

Smokin... 05-26-2013 12:06 PM

Fixed: Apache Internal Server Redirection vhost => vhost not working [Debian & Apache 2]
 
Hi

Added: 'ProxyPreserveHost On' to each of the [82.x.x.x] vhost files.

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

Regards
Nick Adie


All times are GMT -5. The time now is 09:29 AM.