Nginx和PHP-FPM阻止文件夹名称中包含“php”

时间:2015-02-11 11:14:27

标签: magento nginx php

我正在使用Nginx和PHP-FPM与Magento开发电子商务。

我有一个名为" boletophp"的文件夹。并且该网站正在尝试访问此链接:" my.store/skin/boletophp/imagens/logobb.jpg"并且Nginx将链接重写为" my.store/skin/boletophp /"。

我将文件夹名称更改为" boleto"并且图像加载成功,但模块无法正常工作。所以文件夹名称必须是" boletophp"。

这是my.store配置文件:

server {
    server_name my.store;
    access_log /srv/www/my.store/logs/access.log;
    error_log /srv/www/my.store/logs/error.log;
    root /srv/www/my.store/public_html;

    location / {
        index index.html index.htm index.php;
        try_files $uri $uri/ @handler;
    }

    location ~ ^/(app|includes|lib|media/downloadable|pkginfo|report/config.xml|var)/ { internal; }
    location /var/export/ { internal; }
    location /. { return 404; }
    location @handler { rewrite / /index.php; }
    location ~* .php/ { rewrite ^(.*.php)/ $1 last; }

    location ~ \.php$ {
        client_max_body_size 2048M;
        expires off;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /srv/www/my.store/public_html$fastcgi_script_name;
        fastcgi_param MAGE_RUN_CODE default;
        fastcgi_param MAGE_RUN_TYPE store;
    }

    location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
        expires 30d;
        add_header Pragma public;
        add_header Cache-Control "public";
    }
}

版本:

  Nginx: 1.6.2
    PHP: 5.6.5
Magento: 1.9.1

亲切的问候,

William Bertan

1 个答案:

答案 0 :(得分:4)

尝试替换该行:

location ~* .php/ { rewrite ^(.*.php)/ $1 last; } 

通过

location ~* \.php/ { rewrite ^(.*.php)/ $1 last; }

我希望它有所帮助!