First time if you got this error when trying to access localhost via a browser, we do not want to panic. Need to check the permissions on the directory which is access control in configuration.

Here are some examples of old and new Apache versions ways to do the same access control.

The below configurations says there is no authentication and all requests are allowed. For example,

Apache-2.2 configuration:


<Directory /your/site/path>
       Options Indexes FollowSymLinks
       AllowOverride None
       Order allow,deny
       Allow from all
</Directory>


Apache-2.4 configuration:

<Directory /your/site/path>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>


The below configurations says,  there is no authentication and all hosts in the thelinuxfaq.com domain are allowed access; all other hosts are denied access.

Apache-2.2 configuration:

    <Directory /your/site/path>
        Options Indexes FollowSymLinks
        Order Deny,Allow
        Deny from all
        Allow from thelinuxfaq.com
    </Directory>


Apache-2.4 configuration:
​​
    <Directory /your/site/path>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require host thelinuxfaq.com
    </Directory>


The below configurations says there is no authentication and all requests are denied. same as above example can use it.

Apache-2.2 configuration:

Order deny,allow
Deny from all
​​

Apache-2.4 configuration:

Require all denied
​​

You must do restart the Apache service once updated in httpd.conf or Virtual Host files.