【问题标题】:Installing Magento 2.0.2 on Nginx setup page not functioning在 Nginx 设置页面上安装 Magento 2.0.2 不起作用
【发布时间】:2016-05-28 07:46:11
【问题描述】:

需要帮助在 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。

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

【问题讨论】:

    标签: php magento nginx rewrite magento-2.0


    【解决方案1】:

    正如我所见,这个问题变得越来越普遍。看来 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";
    }}
    

    【讨论】:

    • 我实际上忘记了我发了这篇文章,但我几天前修复了它并发现这是确切的问题,谢谢。
    • 你摇滚@PermaNull :)
    猜你喜欢
    • 2019-06-22
    • 1970-01-01
    • 2014-02-05
    • 2017-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多