1

Getting a 403 error on DocumentRoot for my httpd-vhosts file. '

NOTE: I'm on MAC OSX Sierra 10.12

The tutorial I'm following is here - as instructed I ran chmod 755 /sites/blog/my-website/web but it didn't fix the issue. I also ran as sudo but was unsuccessful.

It is important to note I flushed my cache and restarted after running chmod with the following commands:

sudo apachectl restart

dscacheutil -flushcache

In httpd.conf file, I have the following line uncommented (again as instructed by tutorial):

# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf

My httpd-vhosts.conf configuration is below:

<VirtualHost *:80>
    DocumentRoot "/sites"
</VirtualHost>

<VirtualHost *:80>
        DocumentRoot "/sites/blog/my-website/web"
        ServerName mywebsite.dev
        ErrorLog "/private/var/log/apache2/connor.local-error_log"
        CustomLog "/private/var/log/apache2/connor.local-access_log" common

        <Directory "/sites/blog/my-website/web">
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

Any ideas what I could be doing wrong? If more info is needed let me know.

kawnah
  • 3,204
  • 8
  • 53
  • 103

1 Answers1

1

Apache VirtualHost 403 Forbidden

Is what fixed it. Quote from answer:

Apache 2.4.3 (or maybe slightly earlier) added a new security feature that often results in this error. You would also see a log message of the form "client denied by server configuration". The feature is requiring a user identity to access a directory. It is turned on by DEFAULT in the httpd.conf that ships with Apache. You can see the enabling of the feature with the directive

I needed to add Require all granted in <Directory></Directory>

kawnah
  • 3,204
  • 8
  • 53
  • 103