当前位置:Gxlcms > PHP教程 > nginx服务器上访问不存在的php页面Noinputfilespecified

nginx服务器上访问不存在的php页面Noinputfilespecified

时间:2021-07-01 10:21:17 帮助过:7人阅读

nginx服务器下访问不存在的php页面No input file specified.
在nginx/conf/nginx.conf 找到:
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 改为:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;


http://apps.hi.baidu.com/share/detail/31677987
http://www.oschina.net/question/57933_27069




nginx服务器下访问不存在的非php页面,可以正常出现自定义的404提示页,但是访问不存在的php页面,页面信息显示
初步估计是fastcgi没把错误给Nginx
查了下nginx的文档 果然
fastcgi_intercept_errors
syntax: fastcgi_intercept_errors on|off
default: fastcgi_intercept_errors off
context: http, server, location 
默认的是off

只需在虚拟主机配置文件加入:
fastcgi_intercept_errors on;

即可。我配置了error_page 404,没有使用nginx默认的404提示页面。
效果图:



配置文件里面的编写

人气教程排行