2

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.

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

2 Answers 2

0

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.

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

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.

You can also see this article How to Install Magento with Nginx on Ubuntu 16.04".

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.