繁体   English   中英

Magento nginx重写或内部重定向周期,同时处理“ /index.php”

[英]Magento nginx rewrite or internal redirection cycle while processing “/index.php”

我是magento和nginx的新手,正在尝试修复网站上的损坏链接。

在我的Nginx错误日志中,我有以下内容:

2017/09/11 17:09:00 [错误] 23457#23457:* 15处理“ /index.php”时重写或内部重定向周期,客户端:127.0.0.1,服务器:localhost,请求:“ GET / index。 php HTTP / 1.1“,主机:” localhost“,引荐来源网址:” http:// localhost / princess-highway /

在我的Nginx默认配置文件中,我具有以下内容:

# magento specific nginx config for the frontend

server {
  listen 80;
  server_name localhost;
  root /var/www/html;

  # check if Load Balancer handled SSL
  set $elb_https "off";
  if ($http_x_forwarded_proto = "https") {
    set $elb_https "on";
  }

  add_header X-Whom $hostname;
  client_max_body_size 2m;

  location / {
    index index.html index.php;
    try_files $uri $uri/ @handler;
    # testing found online
    # try_files $uri $uri/ /index.php?$query_string;
    expires 30d; ## Assume all files are cachable
  }

  ## block access
  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 /downloader/         { deny all; }
  location /errors/             { deny all; }
  location /shell/              { deny all; }

  location ~ rss/catalog/(review|notifystock) {
    deny all;
  }

  ## disable .htaccess and other hidden files
  location  /. {
    return 404;
  }

  ## block API access on non-admin instances
  location /api                 { deny all; }

  ## block rss feeds
  location /rss                 { return 404; }

  ## block test scripts
  location ^~ /dev/             { return 403; }

  ## disable hidden files, git files + composer.json
  location ~ /(\.|\.git|composer.json|composer.lock) {
    return 404;
  }

  ## allow access
  location /var/google/         { allow all; }

  #location /admin {
  #  rewrite ^.* http://localhost/factoryx permanent;
  #}

  #location /factoryx {
  #  rewrite ^.* https://ao-admin.ap-southeast-2.staging.factoryx.io/factoryx permanent;
  #}

  location ~ "^/media/picklists/[a-zA-Z0-9]{32}/$" {
    autoindex on;
    autoindex_localtime on;
  }

  ## Magento uses a common front handler
  location @handler {
    rewrite / /index.php;
  }

  location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    expires 1y;
    log_not_found off;
  }

  ## Forward paths like /js/index.php/x.js to relevant handler
  location ~ .php/ {
    rewrite ^(.*.php)/ $1 last;
  }

  location ~ .php$ {
    if (!-e $request_filename) { rewrite / /index.php last; }

    expires        off;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_param  HTTPS $elb_https;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param  MAGE_RUN_CODE default;
    fastcgi_param  MAGE_RUN_TYPE store;
    include        fastcgi_params; ## See /etc/nginx/fastcgi_params
    fastcgi_read_timeout 300;
  }
}

我有这样的链接: http://localhost/princess-highway/index.php/contacts上面的链接将起作用,但是导航菜单上的实际链接将带您到这里: http:// localhost / princess-highway /联系人从链接中省略了index.php,我将收到500错误的网关错误。

我对此很陌生,所以请告知我是否可以提供更多信息。

谢谢!

在需要格式化时将答案用作注释

尝试添加位置

location /princess-highway/ {
   rewrite /princess-highway/(.*) /princess-highway/index.php/$1;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM