Page 1 of 1

Error 403 when using local hosts

PostPosted: 23. April 2006 17:00
by Gee Bee
Hi everyone,

Im trying to setup a virtual host on my local machine to use in a development enviroment but its not working.

Can anyone tell me what im doing wrong as im very confused! Im using apache 2.2 with windows xp pro. My vhosts file has the following in it


NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "C:/Websites/mySite.dev/publish/"
ServerName mySite.dev:80
</VirtualHost>

It keeps showing error 403 access forbidden for both mySite.dev and localhost. The error log shows the following;

[Sun Apr 23 16:59:13 2006] [error] [client 127.0.0.1] (20023)The given path was above the root path: Cannot map GET /xampp/ HTTP/1.1 to file

Any help would be greatly appreciated.

PostPosted: 09. May 2006 16:09
by capitalfellow
The more fine grained apache directives over ride the settings of those that are higher up. If you were to look in C:\your_path\xampp\apache\conf\httpd.conf

you'd see that the DocumentRoot is set to

C:/xampp/xampp/htdocs

So any file or folder below that already had has permission to be served out such as

C:/xampp/xampp/htdocs/foo

you would be able to access with http://localhost/foo

But your virtual host DocumentRoot is outside of that higher up DocumentRoot. So you need to explicity give the webserver permission to serve out content from that directory:

<VirtualHost *:80>
ServerName mySite.dev:80
DocumentRoot "C:/Websites/mySite.dev/publish/"
<Directory "C:/Websites/mySite.dev/publish/">
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>