LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 03-22-2005, 01:08 PM   #1
eckertc1
Member
 
Registered: Feb 2005
Posts: 57

Rep: Reputation: 15
Apache 2 Virtual host


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. the address bar displays the correct site but the window is showing the index.html for the first site in the vhosts 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-22-2005, 01:34 PM   #2
Technoslave
Member
 
Registered: Dec 2003
Location: Northern VA
Posts: 493

Rep: Reputation: 30
Try just using <VirtualHost *>
 
Old 03-22-2005, 02:01 PM   #3
eckertc1
Member
 
Registered: Feb 2005
Posts: 57

Original Poster
Rep: Reputation: 15
tried it, still not working. the correct address is showing in the address bar but the wrong site is being displayed
 
Old 03-22-2005, 03:15 PM   #4
eckertc1
Member
 
Registered: Feb 2005
Posts: 57

Original Poster
Rep: Reputation: 15
OK i have an update to the problem. i believe that for some reason my server alias is messing up intermittently. to test this i entered www.mydomain1.com into the address bar and mydomain1.com into the address bar and checked that they both returned the same page.....

They did....

so i tried the same test on www.mydomain2.com and it returned the correct page for that address. but using mydomain2.com returned the index page for mydomain1.com....

so I'm guessing this is a alias problem but I'm not sure what it could be. here is how i have the alias configured inside each Vhost tag....:

ServerAlias mydomain1.com *.mydomain1.com

ServerAlias mydomain2.com *.mydomain2.com

any ideas???
 
Old 03-22-2005, 03:50 PM   #5
eckertc1
Member
 
Registered: Feb 2005
Posts: 57

Original Poster
Rep: Reputation: 15
the above post worked when i tried it the first time but now it does not work. I'm getting really frustrated with this

been trying to solve this same problem for over 2 weeks now and NO ONE seems to have had a similar problem or a solution.


Last edited by eckertc1; 03-22-2005 at 04:05 PM.
 
Old 03-22-2005, 05:45 PM   #6
Technoslave
Member
 
Registered: Dec 2003
Location: Northern VA
Posts: 493

Rep: Reputation: 30
Get rid of ServerAlias, change your Servername to just the domain name and then let DNS deal with the rest.
 
Old 03-22-2005, 10:58 PM   #7
eckertc1
Member
 
Registered: Feb 2005
Posts: 57

Original Poster
Rep: Reputation: 15
well that seemed to solve my problem for the time being.

externaly i have been able to reach the right page with either address for over 2hrs now but on the network it still works sometimes and not others.

this is a strange problem if i have ever seen one. why would it work off and on like this??
 
  


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 - Name virtual host tisource Linux - Networking 5 03-03-2006 03:52 AM
Apache 2.0 Virtual Host? w0lfeyes Linux - Networking 1 05-03-2004 04:09 PM
Virtual host and apache Samspeed Linux - General 8 08-06-2003 08:41 AM
apache virtual host navinc Linux - Software 10 05-22-2003 01:16 PM
apache virtual host mimi Linux - General 1 04-06-2002 06:11 AM


All times are GMT -5. The time now is 12:53 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