Nginx no input file specified
微wx笑 2019-08-28【网络工具】 13 0关键字: Nginx php 帝国CMS
将线上的帝国CMS压缩备份下载到本地部署后,访问时页面显示:no input file specified,打开开发者工具,看到的响应代码是404,查找了很多解决方案都没有解决,然后去看Nginx的日志,在 e
将线上的帝国CMS压缩备份下载到本地部署后,访问时页面显示:no input file specified,打开开发者工具,看到的响应代码是404,查找了很多解决方案都没有解决,然后去看Nginx的日志,在 error.log 中看到以下内容:
[error] 2998#0: *1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open_basedir restriction in effect. File(/Users/aven/Downloads/ivu4e.com20190815/e/admin/index.php) is not within the allowed path(s): (/www/wwwroot/ivu4e.com/:/tmp/:/proc/) in Unknown on line 0 PHP message: PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0 Unable to open primary script: /Users/aven/Downloads/ivu4e.com20190815/e/admin/index.php (Operation not permitted)" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /e/admin/index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:886" 2019/08/28 10:43:38 [error] 2998#0: *1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open_basedir restriction in effect. File(/Users/aven/Downloads/ivu4e.com20190815/e/admin/index.php) is not within the allowed path(s): (/www/wwwroot/ivu4e.com/:/tmp/:/proc/) in Unknown on line 0 PHP message: PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0 Unable to open primary script: /Users/aven/Downloads/ivu4e.com20190815/e/admin/index.php (Operation not permitted)" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /e/admin/index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:886" 2019/08/28 10:43:39 [error] 2998#0: *1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open_basedir restriction in effect. File(/Users/aven/Downloads/ivu4e.com20190815/e/admin/index.php) is not within the allowed path(s): (/www/wwwroot/ivu4e.com/:/tmp/:/proc/) in Unknown on line 0 PHP message: PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0 Unable to open primary script: /Users/aven/Downloads/ivu4e.com20190815/e/admin/index.php (Operation not permitted)" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /e/admin/index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:886"
看到 not within the allowed path(s): (/www/wwwroot/ivu4e.com/:/tmp/:/proc/) ,线上环境配置的目录就是 /www/wwwroot/ivu4e.com/,猜测可能是这个问题导致的,于是查找 /www/wwwroot/ivu4e.com/ 出现在哪个文件里,结果搜索到是“.user.ini”,打开看到文件的内容是:
open_basedir=/www/wwwroot/ivu4e.com/:/tmp/:/proc/
估计就是它的问题了,将文件重命名:
mv .user.ini abc.user.ini
再访问网站,问题解决了。
看来查看日志才是最有效的方法。
注:
php文件不存在也会返回此信息,这时你需要访问目录,然后查看Nginx的错误日志 ,查看Nginx访问的实际目录。
本文由 微wx笑 创作,采用 署名-非商业性使用-相同方式共享 4.0 许可协议,转载请附上原文出处链接及本声明。
原文链接:https://www.ivu4e.cn/toolbox/newwork/2019-08-28/161.html