logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache Internal Server Redirection vhost => vhost not wor
Author
Smokin...



Joined: 26 May 2013
Posts: 2
Location: Hastings, UK

PostPosted: Sun 26 May '13 15:54    Post subject: Apache Internal Server Redirection vhost => vhost not wor Reply with quote

Hi

Any help anyone can give me on this problem would be appreciated.

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] Very Happy

moodle.example.com [82.x.x.x] however returns joomla.example.com [192.168.20.100] Crying or Very sad

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>
Back to top
admin
Site Admin


Joined: 15 Oct 2005
Posts: 702

PostPosted: Sun 26 May '13 16:48    Post subject: Reply with quote

The first VirtualHost section is used for all requests that do not match a ServerName or ServerAlias in any <VirtualHost> block.

Because you have no First/Default host as vhost in 192.xx it serves the joomla one. So with Joomla you are lucky.

Maybe helps that you add in 82.xx :

ProxyPreserveHost On

See.. http://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypreservehost
Back to top
Smokin...



Joined: 26 May 2013
Posts: 2
Location: Hastings, UK

PostPosted: Sun 26 May '13 19:56    Post subject: Fixed: Apache Internal Server Redirection vhost => vhost Reply with quote

Hi,

As suggested -

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>

Works with no problems. Thanks

Regards
Nick Adie
Back to top


Reply to topic   Topic: Apache Internal Server Redirection vhost => vhost not wor View previous topic :: View next topic
Post new topic   Forum Index -> Apache