- Magento 1.9.2.1
- Nginx 1.8.1
I'm trying to set up a Magento shop, a development server with Nginx for further change.
Currently, it runs on a server with Apache.
Developing I have no problems with redirects. The frontend works well. I used to access the dashboard http: //www.domain.tld/index.php/admin/
But it does not work on my Nginx installation.
If you use http://www.domain.tld/admin/ it asks for my user and password, but then I redirected to a page http://www.domain.tld//index.php/admin/admin/dashboard/index/ giving a 404 error.
server {
listen x.xxx.xxx.x:80;
server_name domain.es www.domain.es;
root /home/user/web/domain.es/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/domain.es.log combined;
access_log /var/log/nginx/domains/domain.es.bytes bytes;
error_log /var/log/nginx/domains/domain.es.error.log error;
location / {
# START Tamaniut
try_files /maintenance.html $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
expires 30d; ## Assume all files are cachable
# END tamainut
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass 127.0.0.1:9002;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias /home/user/web/domain.es/document_errors/;
}
#START tamainut
#location ~* "/\.(htaccess|htpasswd)$" {
# deny all;
# return 404;
#}
##
# dont log robots.txt requests
##
location /robots.txt {
allow all;
log_not_found off;
access_log off;
}
## These locations would be hidden by .htaccess normally
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/ { deny all; }
# deny htaccess files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
#This @handler it's on several tips on stackExchange, Magento Exchange, but when try restart get: "named location "@handler" can be on the server level only"
#location @handler { ## Magento uses a common front handler
# rewrite / /index.php;
#}
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}
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;
# END Tamainut
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
#include /home/user/conf/web/nginx.naturjoya.es.conf*;
}