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)

  • show the error details here after upgrade command
    – Vishnunath
    Jun 16, 2018 at 10:39
  • Please check my answer Jun 16, 2018 at 11:13

3 Answers 3


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

  • Rohan Hapani@perfect , but can you exaplin this chown -R www-data:www-data /var/www/html/magento2 Jun 16, 2018 at 12:26
  • These permissions apply to that user and group who has special access to the file. chown -R your_user_name:your_user_group_name /var/www/html/magento2 for set Jun 16, 2018 at 13:20
  • please upvote on answer. So, it will useful for other user. Jun 16, 2018 at 13:53
  • @RohanHapani How can i solve 403 in Rest API error : snag.gy/TY8nJ1.jpg, if i try with it is working.
    – zus
    Oct 23, 2018 at 9:34

Run below command after setup:upgrade

php bin/magento setup:static-content:deploy
  • Prashant Valanda@I did but still facing 403 issue, this issue only run when i run upgrade comond Jun 16, 2018 at 10:35
  • have you given permission to pub folder after run static content deploy command? Jun 16, 2018 at 10:40
  • Prashant Valanda@yes i given 777 permission Jun 16, 2018 at 10:41
  • when you load any page it shows any error ? Jun 16, 2018 at 10:44
  • @PrashantValanda How can i solve 403 in Rest API error : snag.gy/TY8nJ1.jpg, if i try with it is working.
    – zus
    Oct 23, 2018 at 9:35

When U Install Magento That time Not Add The Js file in pub folder if u Run below command than all Js and templates file deploy in pub Folder

now run this command step by step

php -dmemory_limit=5G bin/magento setup:static-content:deploy -f
php bin/magento cache:flush

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.