Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache Named Virtual Hosts drama
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ifrflyr
n00b
n00b


Joined: 06 Apr 2005
Posts: 44

PostPosted: Mon Apr 25, 2005 8:49 pm    Post subject: Apache Named Virtual Hosts drama Reply with quote

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
View user's profile Send private message
hlevyn
Apprentice
Apprentice


Joined: 14 Jan 2005
Posts: 240
Location: Santa Clara, California

PostPosted: Mon Apr 25, 2005 9:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
ifrflyr
n00b
n00b


Joined: 06 Apr 2005
Posts: 44

PostPosted: Mon Apr 25, 2005 10:00 pm    Post subject: Reply with quote

Thanks. I had looked there. I still don't see what I'm doing wrong!

Anyone?
Back to top
View user's profile Send private message
ragdon
n00b
n00b


Joined: 18 Apr 2004
Posts: 18

PostPosted: Sun May 15, 2005 9:43 am    Post subject: Reply with quote

I have an identical problem, did you ever solve this?
Back to top
View user's profile Send private message
mattt416
n00b
n00b


Joined: 24 Sep 2004
Posts: 14

PostPosted: Sun May 15, 2005 10:11 am    Post subject: Reply with quote

try changing your <VirtualHost *>'s to <VirtualHost *:80>'s. I believe the port needs to be specified in Apache 2.0.
Back to top
View user's profile Send private message
ragdon
n00b
n00b


Joined: 18 Apr 2004
Posts: 18

PostPosted: Wed May 18, 2005 7:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum