I am getting an 403 access forbidden when attempting to open a page under a vhost where the document root is sitting on a different drive than where apache is sitting. I installed using the apachefriends release. This is my httpd-vhosts.conf file:


NameVirtualHost 127.0.0.1

<VirtualHost 127.0.0.1> ServerName foo.localhost DocumentRoot "C:/xampp/htdocs/foo/public" </VirtualHost>

<VirtualHost 127.0.0.1> ServerName bar.localhost DocumentRoot "F:/bar/public" </VirtualHost>

When opening bar.localhost in my browser, Apache is giving me 403 Access Forbidden. I tried setting lots of different access rights, even full rights to everyone, but nothing I tried helped.

Edit: Thanks! For future reference, add 'Options indexes' within to show directory indexes.

share|improve this question
up vote 54 down vote accepted

You did not need

Options Indexes FollowSymLinks MultiViews Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted

the only thing what you need is...

Require all granted

...inside the directory section.

See Apache 2.4 upgrading side:

http://httpd.apache.org/docs/2.4/upgrading.html

share|improve this answer
3  
+1 ed You saved my day :) – Ravi Jan 24 '13 at 10:32
    
great, precise answer! – ub1k Apr 4 '13 at 10:20
2  
+1 This should be the correct answer. saved me a lot of headache. – fatman Jun 25 '13 at 18:18
    
Great. You helped me very much. – Alexey Sidash Sep 22 '13 at 17:34
    
I love you, man. – Felipe Zavan Oct 17 '13 at 20:30

I have fixed it with removing below code from

C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf file

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error.log"
    CustomLog "logs/dummy-host.example.com-access.log" common
 </VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
    ServerName dummy-host2.example.com
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

And added

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    ErrorLog "logs/localhost-error.log"
    CustomLog "logs/localhost-access.log" common
</VirtualHost>

And it has worked like charm

share|improve this answer

For Apache 2.4.2: I was getting 403: Forbidden continuously when I was trying to access WAMP on my Windows 7 desktop from my iPhone on WiFi. On one blog, I found the solution - add Require all granted after Allow all in the <Directory> section. So this is how my <Directory> section looks like inside <VirtualHost>

<Directory "C:/wamp/www">
    Options Indexes FollowSymLinks MultiViews Includes ExecCGI
    AllowOverride All
    Order Allow,Deny
    Allow from all
    Require all granted
</Directory>
share|improve this answer
    
it worked for me – Robi May 12 '14 at 16:45
    
(y) great! Add into vhosts.conf file – NaeN Sep 24 '15 at 9:29
    
it worked for me too on windows with wamp2. – jamlee Jan 5 '16 at 10:09

Somewhere, you need to tell Apache that people are allowed to see contents of this directory.

<Directory "F:/bar/public">
    Order Allow,Deny
    Allow from All
    # Any other directory-specific stuff
</Directory>

More info

share|improve this answer
2  
For me, this file I had to modify was C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf – Paul Ostrowski May 6 '12 at 21:57
    
@Moss - um, yes it does. If you're having difficulty then it is likely there is another problem - perhaps your configuration isn't being read or NTFS permissions are preventing Apache reading it. Perhaps its wise to post your own question if things still don't work for you...? – Mark Embling Jun 2 '12 at 17:28
    
Yeah, I did post my own question: stackoverflow.com/questions/10859271/…. I set permissions to Full Control for Authenticated Users, SYSTEM, Administrators, on every folder from the site up to the drive. What else can be done? – Moss Jun 3 '12 at 3:53
    
OK, I solved it. – Moss Jun 3 '12 at 4:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.