在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页面,页面信息显示[img]http://dl.iteye.com/upload/picture/pic/99927/3805946c-810d-3b08-9f4a-bd817f91e6bb.jpg[/img]
初步估计是fastcgi没把错误给Nginx
查了下nginx的文档 果然
只需在虚拟主机配置文件加入:
即可。我配置了error_page 404,没有使用nginx默认的404提示页面。
效果图:
[img]http://dl.iteye.com/upload/picture/pic/99929/886e785d-9f10-3d69-ba0c-d7563bca605b.jpg[/img]
【[b][color=green]配置文件里面的编写[/color][/b]】
[img]http://dl.iteye.com/upload/picture/pic/108112/474d11f7-72e5-3269-8205-2a49e8189f57.jpg[/img]
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页面,页面信息显示[img]http://dl.iteye.com/upload/picture/pic/99927/3805946c-810d-3b08-9f4a-bd817f91e6bb.jpg[/img]
初步估计是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提示页面。
效果图:
[img]http://dl.iteye.com/upload/picture/pic/99929/886e785d-9f10-3d69-ba0c-d7563bca605b.jpg[/img]
【[b][color=green]配置文件里面的编写[/color][/b]】
[img]http://dl.iteye.com/upload/picture/pic/108112/474d11f7-72e5-3269-8205-2a49e8189f57.jpg[/img]