Going through the magento devdocs on setting up magento 2 enterprise. Ubuntu 16.04 PHP 7.1 https://devdocs.magento.com/guides/v2.2/install-gde/prereq/nginx.html

This is my issue I have worked through all the processes and i went to my site localhost/magento and i get a 403 permissions error.

My base url i set up in magento was http://localhost/magento

So in my magento in the sites-available/magento should server_name http://localhost/magento ? or should it just be magento or just localhost

When i run nginx -t i get this

nginx: [warn] server name "http://localhost/magento" has suspicious symbols in /etc/nginx/sites-enabled/magento:8 nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful

So is the warning what is causing my site to 403?

I appreciate your help, i have been looking all over for fixes but stuff on git, here, and magento forums rent fixing my issue.

My guess is everything has to do with permissions which per the devdocs i set up correctly. This is the permission for the magento folder inside my var/www/html

drwxr-xr-x 14 root www-data 4096 Aug 24 10:58 magento is that correct ?



3 Answers 3


Solved. Ended up being the host name, and then not doing setup:di:compile followed by the static-content:deploy

  • 1
    Since my answer wasn't good enough. Nginx didnt like my localhost/magento. My hostname on my virtual box needed to be the server name. Per the devdocs documentation (cloud documentation) not the standard docs for nginx and magento you are required to do a setup:di:compile followed by the static content deploy -f (-f since i was in developer mode forces the deploy) Appreciate the downvote since nobody bothered to comment on a help. Sep 6, 2018 at 13:13

try this,


bin/magento setup:di:compile


The discussion #757 helped me solve 403 Forbidden error after Install Mark Shust Docker Config for Magento 2 on WSL2.

Your Answer

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

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