3

需要一些帮助在 nginx 1.9.3 上使用 php-fpm 安装 Magento 2.0.2 目前我正在使用 Magento 提供的默认配置(https://github.com/magento/magento2/blob/develop/nginx.conf.sample)。

正在发生的问题是在解压后访问 /setup 时,我会在“setup/index.php/navigation”以及页面尝试访问的其他 URL 上看到 403。

我已经意识到这背后的问题是它没有将“导航”作为参数传递给 index.php 文件,实际上是在寻找“index.php/navigation”作为文件并试图将其传递给 php5-fpm导致触发 security.limit_extensions 导致 403。

所以问题就变成了如何让请求正确处理?EX 当由设置 index.php 呈现的 javascript 请求 index.php/navigation 我如何确保它作为参数传递给 index.php 而不是像索引一样尝试在“index.php/navigation”中查找文件.php 是一个目录。

4

1 回答 1

8

正如我所见,这个问题变得越来越普遍。看来 fastcgi_split_path_info 需要定义。尝试将 nginx.conf.sample /setup 位置块(我用## 指向解决方案代码)更改为:

location /setup {
root $MAGE_ROOT;
location ~ ^/setup/index.php {

    ### This fixes the problem:
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    ################################

    fastcgi_pass   fastcgi_backend;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

location ~ ^/setup/(?!pub/). {
    deny all;
}

location ~ ^/setup/pub/ {
    add_header X-Frame-Options "SAMEORIGIN";
}}
于 2016-02-17T00:19:55.723 回答