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;
}