通过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 正則 字符串
? }
}
————————————————
版權聲明:本文為CSDN博主「社會劉」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/qq_37779709/article/details/78761515
總結
以上是生活随笔為你收集整理的通过nginx访问.html出现Access Denied提示怎么解决(亲测)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: those 和these区别(these
- 下一篇: 国产车奇瑞怎么样 评测报告及用户口碑?