Magento 2 – Fix 403 Error After Setup:Upgrade Command

Apache2frontendhttp-status-403magento2permissions

I have set 777 permissions for pub/ and var/ directories.
I have run php bin/magento setup:upgrade.
A 403 error is displayed when accessing any page on the website with the following message:

Failed to load resource: the server responded with a status of 403 (Forbidden)

Best Answer

Step 1 : open the terminal and navigate to magento web root

cd /var/www/html/magento2

Step 2 : Deploy command

php bin/magento s:s:d

Step 3 : Reindex command

php bin/magento i:rei

Step 4 : Set owner command

chown -R www-data:www-data /var/www/html/magento2

Step 5 : Give permission command

chmod -R 777 /var/www/html/magento2

Step 6 : Remove cache command

rm -rf var/cache

Related Topic