Magento – Magento 2: Admin returns 404 using NGINX/PHP 7

adminmagento2nginx

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.

Best Answer

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/)