Apache gives me 403 Access Forbidden when DocumentRoot points to two different drives

114,026

Solution 1

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

Solution 2

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

Solution 3

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:
114,026
Jake
Author by

Jake

Updated on July 08, 2022

Comments

  • Jake
    Jake almost 2 years

    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.

  • Paul Ostrowski
    Paul Ostrowski about 12 years
    For me, this file I had to modify was C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf
  • Mark Embling
    Mark Embling almost 12 years
    @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...?
  • Moss
    Moss almost 12 years
    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?
  • Tomer
    Tomer almost 11 years
    +1 This should be the correct answer. saved me a lot of headache.
  • Alexey Sidash
    Alexey Sidash over 10 years
    Great. You helped me very much.
  • krivar
    krivar about 10 years
    In my case I still need Options Indexes FollowSymLinks MultiViews
  • Doug McLean
    Doug McLean about 9 years
    Just to clarify, this is in response to @cloudwhale's answer, yes? link
  • NaeN
    NaeN over 8 years
    (y) great! Add into vhosts.conf file
  • 151291
    151291 almost 6 years
    I am using xampp in Windows server 2012, 'require all granted' written but still same issue.
  • Deepak Thomas
    Deepak Thomas over 4 years
    Apache 2.4 + Windows 10 + XAMPP was giving me the same error (403 forbidden). Most of the answers give "Require all granted" & that was not working. Adding "Options Indexes FollowSymLinks MultiViews Includes ExecCG" worked ! Thanks !
  • Hasanuzzaman Sattar
    Hasanuzzaman Sattar over 3 years
    I was experiencing the same problem. I have an external hard drive in my Windows 10 system and that has the path F. While I tried to create a virtualhost with DocumentRoot "F:/htdocs", I was getting same error. This solution solve my problem.