Fix ‘403 Forbidden’ error on Apache 2.4 HTTP server in Ubuntu

In the latest versions (specifically version 2.4.3 and above) of the Apache 2.4 HTTP server, on a new installation, you may receive the ‘403 Forbidden’ HTTP error when attempting display your site.  To increase security, the Apache developers changed the default configuration to block all requests.  To fix this, you must explicitly grant permissions via your site configuration file.

In Ubuntu Linux, you will need to edit the appropriate site configuration file.  Typically, the name of this file is 000-default.conf and it is located in /etc/apache2/sites-available directory. Open this file in a text editor (remember to open it using sudo, since it is a system file) and add the following line in the <Directory> section:

Require all granted

For example, the updated <Directory> section may now look like:

        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
                Require all granted
        </Directory>

To make this change take effect, you must restart the Apache web server using this command:

sudo service apache2 restart

References

Stack Overflow – Apache VirtualHost 403 Forbidden