Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apache 2.2.2 Virtualhosts How-To

Status
Not open for further replies.

LoganTeamX

IS-IT--Management
Apr 23, 2004
9
CA
I just fought with a lot of fuzzy documentation and older recountings of configuring multiple vhosts on a single Apache box. I figured out how to get it running with 2.2.2 and thought I'd share the wealth ;)

The info shown below goes in your Extra/httpd-vhosts.conf file, and it likely replaces what's there by default.

<VirtualHost *:80>
ServerAdmin admin@domain.com
DocumentRoot /Websites/domain
ServerName ServerAlias *.domain.com
ErrorLog logs/domain.com-error_log
CustomLog logs/domain.com-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin admin@domain.com
DocumentRoot /Websites/domain2
ServerName ServerAlias *.domain2.com
<Directory "c:/websites/domain2">
Allow from all
</Directory>

ErrorLog logs/domain2.com-error_log
CustomLog logs/domain2.com-access_log common
</VirtualHost>

It's important to note the Directory routine within the second VirtualHost. Before doing that entry, I would get a 403 Forbidden all the time on my additional vhost as the default allow permission in HTTPD.conf doesn't carry over to vhosts. After checking the HTTPD.conf and earlier solutions here... I decided to play and the result was exactly what I needed.

I hope that the info above can be of some assistance to others in my place.

Cheers!
 
Hi

No idea why you need that [tt]Allow[/tt] directive there. You are the first I hear needing it.

A hint : when you share experiences like this or in a FAQ, is a good idea to specify the circumstances. Like operating system. I would like to know it.

Feherke.
 
I've tested it twice again. As my default permission on the server is the standard (for 2.2.2 anyways) deny all, it seems to want express permissions for each site within the <Directory> sections.

Personally, I find it a little more secure and not much hassle for one line if you're already using that config section on each vhost. I'm a small fish compared to a lot, so that might colour my opinion slightly.

- Forums and site admin.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top