Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Default Apache Site
PostPosted: Sun Jan 17, 2010 10:04 pm 
Offline
Senior Newbie

Joined: Sun Jan 17, 2010 9:53 pm
Posts: 7
I have multiple virtual host setup within Apache, each of which are named virtual. They are all working fine, but if I type only the IP address into the browser, it looks like the server returns the first virtual host listed.

How can I control the default site directory if only IP is entered? I'd like the default page within /var/www/html to open. This is a CentOS 5.3 installation.

Some settings I have are like this:

DocumentRoot "/var/www/html"

<Directory "/var/www/html">
.... options .....
</Directory>

NameVirtualHost *:80

<VirtualHost *:80>
ServerAdmin admin@emailaddress.com
DocumentRoot /var/www/website1
ServerName www.website1.com
ServerAlias website1.com
ErrorLog logs/website1-error.log
CustomLog logs/website1-access.log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin admin@emailaddress.com
DocumentRoot /var/www/website2
ServerName www.website2.com
ServerAlias website2.com
ErrorLog logs/website2-error.log
CustomLog logs/website2-access.log common
</VirtualHost>


Top
   
 Post subject:
PostPosted: Sun Jan 17, 2010 10:40 pm 
Offline

Joined: Sun Jan 17, 2010 10:39 pm
Posts: 1
Website: http://www.mig5.net
Location: Australia
Perhaps look at Using _default_ vhosts


Top
   
 Post subject:
PostPosted: Sun Jan 17, 2010 11:28 pm 
Offline
Senior Newbie

Joined: Sun Jan 17, 2010 9:53 pm
Posts: 7
Thanks for pointing that out. I should have found it earlier, but for some reason, I missed it.


Top
   
 Post subject:
PostPosted: Mon Jan 18, 2010 10:11 am 
Offline
Senior Member
User avatar

Joined: Tue Nov 24, 2009 1:59 pm
Posts: 362
Bzzt! Wrong!

You're not using per-IP VirtualHosts. _default_ would work then, yes.

You're using NameVirtualHosts.

And in these, the first entry for the IP in question (or the *:80 wildcard, of course) is the one that's used if no ServerName or ServerAlias names equal the Host: header.

TL;DR: With NameVirtualHosts, first <VirtualHost> entry is default entry.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


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

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group