I'm attempting to setup a local development version of Magento 2. I'm importing the database from a currently running Magento installation. The site works correctly, but I'm unable to access the admin page.

I'm using PHP 7, Magento 2 and NGINX with the following configuration:

upstream fastcgi_backend {
  server  unix:/run/php/php7.0-fpm.sock;

server {
  listen 80;
  server_name magento.local;
  set $MAGE_ROOT /home/vagrant/Code/magento;
  include /home/vagrant/Code/magento/nginx.conf.sample;
  error_log  /var/log/nginx/magento.dev-error.log error;
  access_log /var/log/nginx/magento.dev-access.log;

The server returns 404 when visiting /admin (confirmed URL from php bin/magento info:adminuri)

There seems to be a fair few issues posted but I've yet to find a solution! Any advice would be greatly appreciated.

  • when you look into access log , what path nginx is trying to open?
    – MagenX
    Feb 3, 2018 at 10:00
  • Have you fixed it in the end?
    – jtompl
    Jun 5, 2020 at 9:22

2 Answers 2


I am not an expert on vagrant. I have tried it in the past and I have had a lot of trouble. Do not get me wrong, the trouble might be operator error. I have setup Magento 2 on PHP7.0-fpm on digital ocean. I used this configuration: https://goo.gl/NPUiK4. You can also see the "How to Install Magento with Nginx on Ubuntu 16.04" tutorial on my favorite tutorial site: https://goo.gl/xfZJR4 (https://www.howtoforge.com/)


I recommend you use docker, here is an image to instantly deploy: https://github.com/fballiano/docker-magento2

I recommend you disable your caches:

php -f bin/magento cache:flush
sudo rm -rf var/cache var/generation var/page_cache
php -f bin/magento cache:disable
php -f bin/magento setup:upgrade

And check your database table core_config_data and check if the url is ok on web/unsecure/base_url and web/secure/base_url search for %cookie% and delete all rows.

Give right permissions to folders:

chmod -R 777 var
chmod -R 777 pub
chmod -R 777 generated

If nothing works then do this command on CLI:

php bin/magento setup:config:set --backend-frontname="admin_path"

Then use php bin/magento info:adminuri to check.

  • Do you have a suggestion for Docker image that works for Magento 2.3 and 2.4 ?
    – Duke
    Aug 27, 2020 at 7:04

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.