Forum Moderators: phranque

Message Too Old, No Replies

Vhost configuration problem

Vhost configuration problem

         

fentisen

11:32 am on Nov 6, 2005 (gmt 0)

10+ Year Member



Hi,

Iam trying to setup three vhosts. Two vhost with names and one that is the default vhost to handle the [ipnumber...] request.

NameVirtualHost *:80

<VirtualHost _default_:80>
DocumentRoot /var/www/localhost/htdocs
</VirtualHost>

<VirtualHost *:80>
ServerName www.domain1.com
ServerAlias domain1.com *.domain1.com
DocumentRoot /var/www/lekande/htdocs
</VirtualHost>

<VirtualHost *:80>
ServerName www.domain2.org
ServerAlias domain2.org *.domain2.org
DocumentRoot /var/www/kjells/htdocs
</VirtualHost>


When pointing my browser to www.domain2.org then i get the index file of /var/www/kjells/htdocs and that is exactly what i want. But when i point my browser to www.domain1.com then i get the index file of /var/www/localhost/htdocs and that is weird.
Any help is appreciated

jdMorgan

3:20 pm on Nov 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



fentisen,

Welcome to WebmasterWorld!

There are many things that can interfere with the proper operation of VirtualHost. Try this search [google.com] on default server problems with VirtualHost to see if any of the previous discussions provide any useful tips for you.

Jim

mack

3:35 pm on Nov 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Ok i'm being really obvious here, and i'm sure you have it covered... But did you restart apache after you added the VH?

I'm sure you have, but sometmes it's the simple things that give us the run around.

Mack.

fentisen

4:07 pm on Nov 6, 2005 (gmt 0)

10+ Year Member



mack, yeah sometimes you do forget the most basic things, but not this time. I have restarted the server after adding the VH's.

I have read some of the search results and there are somethings that might help me out. I will keep you updated.

fentisen

9:56 pm on Nov 6, 2005 (gmt 0)

10+ Year Member



hmm, i have not been able to solve the problem but here i s something sick, well i think it is.

First i added a subdomain to domain1.com, called local.domain1.com.

Then i edited my httpd.conf to look like this

NameVirtualHost *:80

<VirtualHost *:80>
ServerName local.domain1.com
DocumentRoot /var/www/localhost/htdocs
</VirtualHost>

<VirtualHost *:80>
ServerName domain1.com
DocumentRoot /var/www/lekande/htdocs
</VirtualHost>

<VirtualHost *:80>
ServerName www.domain2.org
ServerAlias domain2.org *.domain2.org
DocumentRoot /var/www/kjells/htdocs
</VirtualHost>


Then i pointed my browser to local.domain1.com and i got the index file of .../localhost/htdocs, just as i wanted.
Then i tried www.domain1.com and i got the index file of ../localhost/htdocs instead of .../lekande/htdocs. Then changed the httpd.conf to look like this:
NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.domain1.com
DocumentRoot /var/www/lekande/htdocs
</VirtualHost>

<VirtualHost *:80>
ServerName local.domain1.com
DocumentRoot /var/www/localhost/htdocs
</VirtualHost>

<VirtualHost *:80>
ServerName www.domain2.org
ServerAlias domain2.org *.domain2.org
DocumentRoot /var/www/kjells/htdocs
</VirtualHost>


Now when pointing my browser to local.domain1.com i get the indexfile of .../lekande/htdocs/, which is Wrong, and when pointing it to www.domain1.com i get the index file of .../lekande/htdocs/, which is correct.
So the server seems to have a problem with the second entry, the second entry always gets directed to the first one. So the second one seems to be wrong/bad no matter how i do. www.domain2.org never fails, and i dont dare to put on the second place ;-)
I hope you understand what i have written, i got a bit confused myself! ;-)