我正在尝试在单独的子域上设置Magento管理员,我正在关注本教程[https://magento2.atlassian.net/wiki/spaces/m1wiki/pages/14024833/Set+up+Magento+backend+on+a+separate+node],但最终出现ERR_TOO_MANY_REDIRECTS
错误。
我仅在访问admin.example.com/index.php/admin
或admin.example.com
时遇到问题,但是我可以访问admin.example.com/test.php
。
下面是我的nginx conf文件,请您提示我所缺少的内容。
server {
listen 80;
server_name admin.example.com;
keepalive_timeout 70;
root /var/www/html/example.prod;
access_log /var/log/nginx/admin_access_log;
error_log /var/log/nginx/admin_error_log;
location / {
return 301 http://admin.example.com/index.php/admin;
#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 ~ .php/ {
rewrite ^(.*.php)/ $1 last;
}
location ~ \.php$ {
try_files $uri =404;
expires off;
fastcgi_read_timeout 1800s;
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;
}
gzip on;
add_header "Access-Control-Allow-Origin" "*";
gzip_min_length 1000;
gzip_proxied any;
gzip_types text/plain application/xml text/css text/js application/x-javascript;
}