0

I am migrating from Apache to Nginx magento. The site works fine but when I try to access the admin generates a 404.

 www.mydomain.com/admin 


This is the configuration that I have on my server

 server { listen 80; server_name www.mydomain.com; root /home/mydomain/public_html; index index.php index.html index.htm; keepalive_timeout 300; access_log logs/access.log; error_log logs/error.log; location / { if (!-e $request_filename) { rewrite ^/([^?]*)(?:\?(.*))? /index.php?title=$1&$2 last; } if ($uri ~* "\.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$") { expires max; break; } } location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ { access_log off; log_not_found off; expires 30d; } location ~ .php/ { rewrite ^(.*.php)/ $1 last; } location ~ .php$ { if (!-e $request_filename) { rewrite / /index.php last; } expires off; fastcgi_pass unix:/tmp/php.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param MAGE_RUN_CODE default; fastcgi_param MAGE_RUN_TYPE store; include fastcgi_params; } location /nginx_status { stub_status on; access_log off; deny all; } location /RequestDenied { return 500; } if ($bad_method = 1) { return 444; } } 

Versions

  1. Nginx/1.4.1
  2. Magento 1.8
  3. MySql 5.1.73
2
  • You can cleared cache? Made sure re-writes are on? Commented Mar 16, 2015 at 22:49
  • @Sebastian, did you find a solution to this? Commented Aug 8, 2018 at 16:44

2 Answers 2

1

What is set in your app/etc/local.xml

It should contain something like

<admin> <routers> <adminhtml> <args> <frontName><![CDATA[admin]]></frontName> </args> </adminhtml> </routers> </admin> 

If frontName is different use that to login in your admin panel.

0

Here is the file off of a production server - Maybe you are missing your @handler items?

server { listen 80; server_name www.domain.com domain.com; keepalive_timeout 70; root /var/www/vhosts/current/; index index.html index.php; access_log /var/log/nginx/access_log; error_log /var/log/nginx/error_log; location / { try_files $uri $uri/ @handler; expires 30d; } location /app/ { deny all; } location /includes/ { deny all; } location /lib/ { deny all; } location /media/downloadable/ { deny all; } location /pkginfo/ { deny all; } location /report/config.xml { deny all; } location /var/ { deny all; } location /var/export/ { auth_basic "Restricted"; auth_basic_user_file htpasswd; autoindex on; } location /. { return 404; } location @handler { rewrite / /index.php; } location ~ .php/ { rewrite ^(.*.php)/ $1 last; } location ~ \.php$ { try_files $uri =404; expires off; fastcgi_read_timeout 900s; fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; } rewrite ^/minify/([0-9]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last; rewrite ^/skin/m/([0-9]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last; location /lib/minify/ { allow all; } gzip on; #gzip_comp_level 9; gzip_min_length 1000; gzip_proxied any; gzip_types text/plain application/xml text/css text/js application/x-javascript; } 
2
  • It does not work . When I try to access /index.php/admin/ I generated 404 When I access / admin / redirects to /index.php Commented Mar 16, 2015 at 22:56
  • you cleared cache, checked urls in database to make sure you don't have a custom? Commented Mar 16, 2015 at 23:32

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.