View previous topic :: View next topic |
Author |
Message |
ifrflyr n00b
Joined: 06 Apr 2005 Posts: 44
|
Posted: Mon Apr 25, 2005 8:49 pm Post subject: Apache Named Virtual Hosts drama |
|
|
Hi everyone.
I have apache 2.0.52 running and I have some problems which I am certain are my fault: Currently pointing a browser at localhost or 127.0.0.1 or namedvirtualhost1 or namedvirtualhost2 all point at the same place: the document root of namedvirtualhost1.
In /etc/apache2/conf/apache2.conf it says:
Code: | ServerRoot /usr/lib/apache2
ServerName localhost
#LockFile /etc/apache2/apache2.lock
PidFile /var/run/apache2.pid
ErrorLog logs/error_log
LogLevel warn
DocumentRoot /var/www/localhost/htdocs/ |
if I don't play with vhosts, surfing to "localhost" or "127.0.0.1" brings me to the file at
/var/www/localhost/htdocs/
As you would expect.
Now I turn on virtual hosts, and in /etc/apache2/conf/vhosts say :
Code: | #Virtual Host for host1.tld
<VirtualHost *>
DocumentRoot /usr/www/users/directory1
ServerName host1.tld
</VirtualHost>
#Virtual host for host2.tld
<VirtualHost *>
DocumentRoot /usr/www/users/directory2
ServerName host2.tld
</VirtualHost>
#Named Virtual Host Directory Directives:
<Directory /usr/www/users/directory1>
order allow,deny
allow from all
</Directory>
<Directory /usr/www/users/directory2>
order allow,deny
allow from all
</Directory>
|
/etc/hosts it says:
Code: | 127.0.0.1 localhost
127.0.0.1 host1.tld
127.0.0.1 host2.tld |
Yet surfing to localhost *or* host1.tld *or * host2.tld brings me to the files at /usr/www/users/directory1
When I then comment out the named directories, surfing to localhost shows the expected files, from /var/www/localhost/htdocs/
There are no relevant errors in /var/log/apache2/error_log
?!!?
I'm sure it's me, but I'm smacking my head against the wall. Any help is appreciated. |
|
Back to top |
|
|
hlevyn Apprentice
Joined: 14 Jan 2005 Posts: 240 Location: Santa Clara, California
|
Posted: Mon Apr 25, 2005 9:30 pm Post subject: |
|
|
I'm not sure how much this will help, but check out the NameVirtualHost directive. _________________ Madness takes its toll. Please have exact change. |
|
Back to top |
|
|
ifrflyr n00b
Joined: 06 Apr 2005 Posts: 44
|
Posted: Mon Apr 25, 2005 10:00 pm Post subject: |
|
|
Thanks. I had looked there. I still don't see what I'm doing wrong!
Anyone? |
|
Back to top |
|
|
ragdon n00b
Joined: 18 Apr 2004 Posts: 18
|
Posted: Sun May 15, 2005 9:43 am Post subject: |
|
|
I have an identical problem, did you ever solve this? |
|
Back to top |
|
|
mattt416 n00b
Joined: 24 Sep 2004 Posts: 14
|
Posted: Sun May 15, 2005 10:11 am Post subject: |
|
|
try changing your <VirtualHost *>'s to <VirtualHost *:80>'s. I believe the port needs to be specified in Apache 2.0. |
|
Back to top |
|
|
ragdon n00b
Joined: 18 Apr 2004 Posts: 18
|
Posted: Wed May 18, 2005 7:09 pm Post subject: |
|
|
I solved my error!
I didn't realise that the links in /var/www/ need to match the domain name i.e. xyz.hopto.org etc. |
|
Back to top |
|
|
|