通过nginx访问.html出现Access Denied提示怎么解决

文件/usr/local/nginx/logs/error.log

FastCGI sent in stderr: "Access to the script '/var/www/html//phpmyadmin/setup/styles.css' has been denied (see security.limit_extensions)"

打开日志发现会出现security.limit_extensions 这样的错误。

经过查找资料发现 从5.3.9开始,php官方加入了一个配置"security.limit_extensions",默认状态下只允许执行扩展名为".php"的文件,造成了其他类型的文件不支持的问题。

所以更改策略如下:

修改/usr/local/php/etc/php-fpm.conf,找到security.limit_extensions把他修改为:

security.limit_extensions=.php .html .js .css .jpg .jpeg .gif .png .htm#(常用的文件扩展名)

然后问题就解决啦!

CGI(Common Gateway Interface) 是WWW技术中最重要的技术之一,有着不可替代的重要地位。
CGI是外部应用程序(CGI程序)与WEB服务器之间的接口标准,是在CGI程序和Web服务器之间传递信息的过程
Nginx 服务器和php的关联配置
nginx.conf文件中:
server{
   location ~  .php${  #location 跳转 ~:不区分大小写 ~*:区分大小写  .php$:.php结尾的文件
      root html;
      fastcgi_pass 127.0.0.1 :9000;
      fastcgi_index  index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
  }
  location ~* .*index.html${
     rewrite .* /test.html  #rewrite regex replacement:rewrite 正则 字符串
  }
}
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值