通过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)"
打開(kāi)日志發(fā)現(xiàn)會(huì)出現(xiàn)security.limit_extensions 這樣的錯(cuò)誤。
經(jīng)過(guò)查找資料發(fā)現(xiàn) 從5.3.9開(kāi)始,php官方加入了一個(gè)配置"security.limit_extensions",默認(rèn)狀態(tài)下只允許執(zhí)行擴(kuò)展名為".php"的文件,造成了其他類型的文件不支持的問(wèn)題。
所以更改策略如下:
修改/usr/local/php/etc/php-fpm.conf,找到security.limit_extensions把他修改為:
security.limit_extensions=.php .html .js .css .jpg .jpeg .gif .png .htm#(常用的文件擴(kuò)展名)
然后問(wèn)題就解決啦!
CGI(Common Gateway Interface) 是WWW技術(shù)中最重要的技術(shù)之一,有著不可替代的重要地位。
CGI是外部應(yīng)用程序(CGI程序)與WEB服務(wù)器之間的接口標(biāo)準(zhǔn),是在CGI程序和Web服務(wù)器之間傳遞信息的過(guò)程
Nginx 服務(wù)器和php的關(guān)聯(lián)配置
nginx.conf文件中:
server{
? ?location ~ ?.php${ ?#location 跳轉(zhuǎn) ~:不區(qū)分大小寫 ~*:區(qū)分大小寫 ?.php$:.php結(jié)尾的文件
? ? ? 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 正則 字符串
? }
}
————————————————
版權(quán)聲明:本文為CSDN博主「社會(huì)劉」的原創(chuàng)文章,遵循CC 4.0 BY-SA版權(quán)協(xié)議,轉(zhuǎn)載請(qǐng)附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/qq_37779709/article/details/78761515
總結(jié)
以上是生活随笔為你收集整理的通过nginx访问.html出现Access Denied提示怎么解决(亲测)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: those 和these区别(these
- 下一篇: 如何去掉字符串最后的逗号?(亲测)