Forum Moderators: phranque

Message Too Old, No Replies

virtualhost configuration and main directory setting

         

JavaReb

5:54 pm on Aug 22, 2008 (gmt 0)

10+ Year Member



Im new to using virtualhost in apache. Im trying to setup 2 of them for testing websites locally. Before deciding to use vhosts, I was just setting my document root to the same path as used for site1. Im sure this is a typical problem...but ive been looking in vain for mentioning of what to do about the main config sections especially the Directory setting, just leave them alone ? Does the vhosts override the directory settings ?

# TESTING VHOST
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1:8080>
ServerName site1.local
DocumentRoot "C:/mystuff/projects/site1/web_root/"
</VirtualHost>
<VirtualHost 127.0.0.1:8080>
ServerName site2.local
DocumentRoot "C:/mystuff/projects/site2/web_root/"
</VirtualHost>

However, in the main part of the configuration file, I still have my directory config set to use the site1 path, like so
<Directory "C:/mystuff/projects/site1/web_root/">

Ive updated my hosts file to include both site1 and site2

When I try site2, apache complains with a 403 error, "You don't have permission to access / on this server."

Help appreaciated!

JavaReb

6:45 pm on Aug 22, 2008 (gmt 0)

10+ Year Member



Well, duh...I needed my two extra <Directory> directives to define the apache permissions on those folders. Once I did that, my vhosts worked as expected.