I'm just messing around with virtual hosts on my XAMPP + Apache install on Windows to make it work so that http://disko.local
redirects to a folder in my PC where the project's files are stored.
I've added the following lines to C:\Windows\System32\drivers\etc\hosts
:
127.0.0.1 localhost
127.0.0.1 disko.local
::1 localhost
And then proceeded to edit the file X:\xampp\apache\conf\httpd.conf
to add these lines at the bottom of the file (do they have to be in any special place?):
# My custom vhosts
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot "X:\Work\Web Development\Projects\disko\serverroot"
ServerName disko.local
</VirtualHost>
With a fast search through the file I determined that that was the only vhost present in the file.
Then I restarted Apache, opened my browser and tried to load the page http://disko.local/artists.html
. This is the error that appeared:
Access forbidden!
You don't have permission to access the requested object. It is either
read-protected or not readable by the server.If you think this is a server error, please contact the webmaster.
Error 403
disko.local 10/22/11 16:06:58 Apache/2.2.21 (Win32) mod_ssl/2.2.21
OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
I tried adding a .htaccess
file containing the string allow from all
but that was of no help.
Here's what the error.log file says:
[Sat Oct 22 16:06:58 2011] [error] [client 127.0.0.1] client denied by server configuration: X:/Work/Web Development/Projects/disko/serverroot/artists.html
What am I doing wrong? Do I have to add anything to the VHost definition? Thanks in advance.
P.S.: Here's the version of Apache, in case it's needed:
X:\xampp\apache\bin>httpd.exe -v
Server version: Apache/2.2.21 (Win32)
Server built: Sep 10 2011 11:34:11
Best Answer
Your missing the directory permissions. Inside the virtualhost block place...
Make changes. Restart Apache.