报错内容
浏览器显示:
access denied
nginx log:
2019/08/01 19:34:19 [error] 75571#0: *29 FastCGI sent in stderr: "Access to the script '/home/Mysticbinary/www/FirstWeek' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 127.0.0.1, server: www.fw.com, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.fw.com"
解决
在解析url时,常常需要将php.ini中的cgi.fix_pathinfo属性值:
cgi.fix_pathinfo = 1
what is fix_pathinfo?
为CGI提供真正的PATH_INFO / PATH_TRANSLATED支持。 PHP的以前的行为是将PATH_TRANSLATED设置为SCRIPT_FILENAME,并且不要弄清PATH_INFO是什么。
有关PATH_INFO的更多信息,请参阅CGI规范。
将其设置为1将导致PHP CGI修复其路径以符合规范。 设置为零会导致nginx是解析不了路径的。