LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-21-2005, 12:19 PM   #1
eckertc1
Member
 
Registered: Feb 2005
Posts: 57

Rep: Reputation: 15
Apache Virtual Host Problem


I know this is a very popular question that has been asked several times over in these forums but nothing so far that i have read has solved my problem. So ill post my own Vhosts question

my problem is this:

i set up name based virtual hosts in apache 2 (running on Fedora Core 3) and all seemed to be working well. but when i came back to visit my site 30 mins later both domains default to the first site in the vhost list.

this problem is very intermittent. about 50% of the time i get the proper web site for the domain i enter into the browser and 50% of the time i get the first site no mater what name i enter.

here is a look at my vhost set up:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.mydomain1.com
ServerAlias mydomain1.com *.mydomain1.com
DocumentRoot /var/www/mydomain1
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/var/www/mydomain1">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.html
</VirtualHost>

<VirtualHost *:80>
ServerName www.mydomain2.com
ServerAlias mydomain2.com *.mydomain2.com
DocumentRoot /var/www/mydomain2
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/var/www/mydomain2">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.html
</VirtualHost>

I'm not sure what is causing this problem, i have changed my vhost configuration a million different ways to match that of others who solved their problems but i always end up with the same symptoms. any help would be great.
 
Old 03-21-2005, 02:07 PM   #2
evil_empire
Member
 
Registered: Mar 2005
Distribution: Fedora Core 3
Posts: 176

Rep: Reputation: 31
And have you configured the DNS appropriately?
 
Old 03-21-2005, 02:17 PM   #3
eckertc1
Member
 
Registered: Feb 2005
Posts: 57

Original Poster
Rep: Reputation: 15
im assuming so since it does work at least half the time.
 
Old 03-21-2005, 04:06 PM   #4
Fredstar
Member
 
Registered: Jul 2004
Location: Rochester, NY
Distribution: Fedora9::FreeBSD7.1
Posts: 296

Rep: Reputation: 30
Quote:
Originally posted by evil_empire
And have you configured the DNS appropriately?
Yes with my DNS host. If thats what you mean. All domains are pointing to my actual ip address.

As for internal DNS i was under the impression that you do not need to set up internal DNS for apache?
 
Old 03-21-2005, 04:22 PM   #5
looseCannon
Member
 
Registered: Dec 2003
Location: Little Rock, AR
Distribution: Fedora Core 2, AIX, HP-UX, Solaris, Whitebox
Posts: 193

Rep: Reputation: 31
Add an entry to /etc/hosts with your servers IP address and each of the sites as aliases.

192.168.1.100 www.host1.com www.host2.com www.host3.com

The problem your having is Apache can't resolve the sites to an ip address, periodically, so it is defaulting to the first site in the list. This plagued me for a while until I figured out how to fix it. I have the same setup on my server at the house and use this solution. No problems what-so-ever.
 
Old 03-21-2005, 04:29 PM   #6
eckertc1
Member
 
Registered: Feb 2005
Posts: 57

Original Poster
Rep: Reputation: 15
loose your a life saver.

i have been having this problem for weeks and i think this finaly solved my problem.

the only think i am concerned about is if anything will auto update my hosts file in the future and mess with the current set up but for now all is well.

thks again
 
Old 03-21-2005, 05:51 PM   #7
eckertc1
Member
 
Registered: Feb 2005
Posts: 57

Original Poster
Rep: Reputation: 15
Oh for the love of GOD what is goin on here lol.

everything worked fine for about 2hrs after i made the changes you suggested and then to my horror it started acting up again. www.mydomain1.com and www.mydomain2.com are now both defaulting to mydomain1's index page.

the url in the address bar shows the correct page but the page itself is coming up as the first page in the vhost list again. some times it works, some times it doesn't.

Please help
 
Old 03-22-2005, 07:06 AM   #8
eckertc1
Member
 
Registered: Feb 2005
Posts: 57

Original Poster
Rep: Reputation: 15
bump
 
Old 03-22-2005, 01:20 PM   #9
evil_empire
Member
 
Registered: Mar 2005
Distribution: Fedora Core 3
Posts: 176

Rep: Reputation: 31
Well, I would still suggest, use the DNS approach.
 
Old 03-22-2005, 10:03 PM   #10
Fredstar
Member
 
Registered: Jul 2004
Location: Rochester, NY
Distribution: Fedora9::FreeBSD7.1
Posts: 296

Rep: Reputation: 30
Quote:
Originally posted by evil_empire
Well, I would still suggest, use the DNS approach.

Still not working

I have set up the dns

192.168.0.100 www.thissite.com www.thatsite.com www.who.com

but everything still going to www.thissite.com
 
Old 03-23-2005, 08:12 AM   #11
looseCannon
Member
 
Registered: Dec 2003
Location: Little Rock, AR
Distribution: Fedora Core 2, AIX, HP-UX, Solaris, Whitebox
Posts: 193

Rep: Reputation: 31
I didn't see this in any of the posts before, so I'll ask this now. What version of Apache are you using?
 
Old 03-23-2005, 04:31 PM   #12
Fredstar
Member
 
Registered: Jul 2004
Location: Rochester, NY
Distribution: Fedora9::FreeBSD7.1
Posts: 296

Rep: Reputation: 30
Quote:
Originally posted by looseCannon
I didn't see this in any of the posts before, so I'll ask this now. What version of Apache are you using?
Apache 2.0
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache and Virtual Host Problem sekondborn Linux - Software 9 02-12-2005 03:26 PM
Apache virtual host problem Adrohak Linux - Software 3 07-18-2004 05:17 PM
Apache 2.0 Virtual Host Problem frankd99 Linux - Software 3 02-16-2004 01:23 PM
Apache Virtual Host Problem clanx Linux - Software 3 01-07-2004 02:36 AM
Virtual Host Problem using Apache ataber Linux - Newbie 2 01-27-2003 01:32 PM


All times are GMT -5. The time now is 11:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration