|
Home > Archive > Apache Server configuration support > January 2007 > Multi WebHosting....
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Multi WebHosting....
|
|
| StephaneM 2007-01-30, 7:27 pm |
| Hi,
I can see something weird happening at the moment :
My Httpd conf file is :
UseCanonicalName On
DocumentRoot "/var/www/html"
<Directory "/var/www/html/">
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/var/www/html">
Also
<VirtualHost *:80>
ServerName www.aaaa.com
ServerAlias aaaa.com www.aaaa.com
ServerAdmin webmaster@aaaa.com
DocumentRoot /home/aaaa
ErrorLog logs/www.aaaaa_error_log
CustomLog logs/aaaa.com-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerName www.bbbb.com
ServerAlias bbbbo.uk www.bbbb.com localhost
ServerAdmin webmaster@bbbb.com
DocumentRoot /home/bbbb
ErrorLog logs/www.bbbb.com_error_log
CustomLog logs/www.bbbb.com_log common
</VirtualHost>
--------------------------------------
Here is my conifg.
If put 'localhost' as written -> No problem => go to display : www.bbbb.com
If I move 'localhost' from the website : www.bbbb.com ->www.aaaa.com
No problem, http://localhost will display the right website.
Now, If I remove completely "localhost" I should go to /var/www/html !?
But I don't, I go to www.aaaa.com !!!!!!!
Any idea why ??
I am using CentOS v4.4
Thanks and regards,
Stephane
| |
| shimmyshack 2007-01-30, 7:27 pm |
| On 30 Jan, 22:18, StephaneM <Steph...@M.com> wrote:
> Hi,
>
> I can see something weird happening at the moment :
>
> My Httpd conf file is :
>
> UseCanonicalName On
> DocumentRoot "/var/www/html"
> <Directory "/var/www/html/">
> Options FollowSymLinks
> AllowOverride None
> </Directory>
>
> <Directory "/var/www/html">
>
> Also
>
> <VirtualHost *:80>
> ServerNamewww.aaaa.com
> ServerAlias aaaa.comwww.aaaa.com
> ServerAdmin webmas...@aaaa.com
> DocumentRoot /home/aaaa
> ErrorLog logs/www.aaaaa_error_log
> CustomLog logs/aaaa.com-access_log common
> </VirtualHost>
> <VirtualHost *:80>
> ServerNamewww.bbbb.com
> ServerAlias bbbbo.ukwww.bbbb.comlocalhost
> ServerAdmin webmas...@bbbb.com
> DocumentRoot /home/bbbb
> ErrorLog logs/www.bbbb.com_error_log
> CustomLog logs/www.bbbb.com_logcommon
> </VirtualHost>
>
> --------------------------------------
>
> Here is my conifg.
>
> If put 'localhost' as written -> No problem => go to display :www.bbbb.com
>
> If I move 'localhost' from the website :www.bbbb.com->www.aaaa.com
> No problem,http://localhostwill display the right website.
>
> Now, If I remove completely "localhost" I should go to /var/www/html !?
> But I don't, I go towww.aaaa.com!!!!!!!
> Any idea why ??
>
> I am using CentOS v4.4
>
> Thanks and regards,
>
> Stephane
the browser sends the name of the host in the url to apache at request
time,
apache then uses that value and compares it to vhosts, if no match
serves first one no matter what its called.
its in the docs (see "main host goes away" half way down):
http://httpd.apache.org/docs/2.2/en...name-based.html
I personally have this as the first one:
<VirtualHost 192.168.5.5:80>
ServerName default
DocumentRoot path_to/vhosts/192.168.5.5/public
</VirtualHost>
where 192.168.5.5 is the IP address my server is bound to (I dont bind
to all IPs I have instead a Listen 192.168.5.5:80 at start of conf)
this means if any http/1.0 requests is made (which DONT send the value
of the host from the url with the request), apache will not match
anything and serve up the file in the IP address/public folder - which
just says hello or whatever. I dont support http/1.0
check out also the use of _default_
http://httpd.apache.org/docs/2.2/en...html#servername
|
|
|
|
|