Magento – Magento 2: 403 error when visiting website in browser

apacheApache2cpanelgodaddymagento2

When I connect from my local machine to a live instance of Magento 2, I get a 403 Error with the following message:

Forbidden

You don't have permission to access / on this server.

Server unable to read htaccess file, denying access to be safe

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Screenshot of 403 error

Best Answer

How to fix

In order to resolve the 403 Forbidden problem you have to adjust permissions for user which is used to run localhost server.

  1. Find your username with this command:
whoami
  1. Then navigate and check if you have config for this user or create if doesn’t exist:
cd /etc/apache2/user/
touch <username>.conf

Where username is an user name used to run Apache server.

  1. Add the following configuration (note that this is only for Yosamite):
sudo vi /etc/apache2/user/<username>.conf

Add the following content:

<Directory "/Users/<username>/Sites/">
AddLanguage en .en
LanguagePriority en fr de
ForceLanguagePriority Fallback
Options FollowSymlinks Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from localhost
Require all granted
</Directory>
  1. Add lines in the /etc/apache2/httpd.conf configuration file:
sudo vi /etc/apache2/httpd.conf

Check and uncomment the line:

Include /private/etc/apache2/extra/httpd-userdir.conf
  1. In the httpd-userdir.conf file ensure to uncomment line:
Include /private/etc/apache2/users/*.conf
  1. Restart Apache server
sudo /usr/sbin/httpd -k restart

Enjoy developing your Magento 2 projects.

Source From : maxpronko

Related Topic