I have a new server, it is Nginx using mysql. I have been developing code locally on a MAMP install. I then migrated this code to git and moved a copy of the database to the new server.

I configured Nginx and restored this database to the new server. All pages, both frontend and backend resolve to the magento 404 page (not the nginx 404 page) This tells me that I am getting into the Magento application but something is not quite right.

I then tried to view the logs in the magento/var/log directory, specifically the system.log and exception.log. No logs are getting generated. I thought this was a permission issue, so I placed a snippet of code in the Mage.php file. This code is:

Mage::log('Test', null, 'test.log');

This results in a log file getting created. Since I do not have access to the admin area, I went into the database and made sure that the following keys are set:

dev/log/active = 1

dev/log/exception_file = exception.log

dev/log/file = system.log

scope_id = 0

in the core_config_data table.

I went to the magento index.php page and set the following:

 ini_set('display_errors', 1);

Still am not getting any logs as to the 404 problem. Just to test, I browsed to the install.php page and was given an error message and a log was generated.

I was thinking this was a user related problem. Here is my setup:

Nginx runs under the Nginx account I have a group called webdev

Nginx is a part of this group

The Magento application is under the magentodev account, which is a member of the webdev group

1 Answer 1


Here is the fix if a googler stumbles upon this in the future. Even though the 404 error was from magento, it was still an Nginx issue. In the Nginx vhost config file, it was running the default store. Here is how to fix this.

mysql> select * from core_store;

| store_id | code     | website_id | group_id | name     | sort_order | is_active |
|        0 | admin    |          0 |        0 | Admin    |          0 |         1 |
|        1 | mystore  |          1 |        1 | mystore |          0 |         1 |

Write this down. Now go into the nginx vhost config file, change this:

fastcgi_param MAGE_RUN_CODE default;

to this:

fastcgi_param MAGE_RUN_CODE mystore;

Test the config file

nginx -t

The reload page

nginx -s reload
  • If this works for you please accept your own answer :)
    – sv3n
    Commented Jun 9, 2017 at 13:20
  • 1
    I can - in 21 hours, not my rules - but is SO rules Commented Jun 9, 2017 at 15:49
  • 1
    you aren't meant to leave comments thanking people but i sorted through stuff for ages to find this, thanks
    – John
    Commented Feb 8, 2019 at 7:41

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.