zoukankan      html  css  js  c++  java
  • nginx报错日志:see security.limit_extensions

    第一:

    访问出现部分.js.css等部分文件被拒绝错误日志如下:

     19:20:13 [error] 1181#0: *287 FastCGI sent in stderr: "Access to the script '/usr/share/php/what/index.php' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 115.238.51.194, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "zheshisha.net"

    经检查,php-fpm服务器的配置文件拒绝,修改文件(/etc/php-fpm.d/www.conf)配置选项如下:

    security.limit_extensions=.php .php3 .php4 .php5 .html .js .css .jpg .jpeg .gif .png .htm

    重启php-fpm服务

    访问测试有问题,那么需要nginx.conf也需要对应做修改,如下:

    location ~ .*.(gif|jpg|jpeg|bmp|png|ico|txt|js|css|json|eot|svg|ttf|woff|apk)$
    {
    root /usr/share/php/what;
    expires 7d;
    }

    第二种情况是:修改php-fpm.ini 里面的参数

    如果用fastcgi 模块 

    cgi.fix_pathinfo=1 必须设置成1
     762 #需要着重提醒的是,如果文件不存在,则阻止 Nginx 将请求发送到后端的 PHP-FPM 模块, 以避免遭受恶意脚本注入的攻击
     763 cgi.fix_pathinfo=1
  • 相关阅读:
    C++面试考点
    C++面试考点
    C++11 引用叠加规则和模板参数类型推导规则
    C++11 引用叠加规则和模板参数类型推导规则
    C++11 auto和decltype推导规则
    C++11 auto和decltype推导规则
    RVO和NRVO
    RVO和NRVO
    Strange Bank(找零问题)
    eli和字符串 (牛客假期训练)
  • 原文地址:https://www.cnblogs.com/wanglijun/p/8733522.html
Copyright © 2011-2022 走看看