nginx支持404公益,帮助孩子回家
404页面
现在是午夜1点39分,这里就是想普及一下404公益活动。当你访问的网站出了问题或者用户试图访问一个不存在的页面时,此时服务器(nginx)会返回状态码为404的错误信息,此时对应的页面就是404页面。nginx服务器默认的404内容为404 not found!
404公益
我认为,当碰到404错误时不应该仅仅呈现一个无关紧要的页面,正巧发现了qq搞了404公益活动,正和我益,可以帮助孩子回家。有时候一个人的技术进步固然让自己开心,但是真正的去做公益才会让人得到满足,附加一个404公益的链接:http://yibo.iyiyun.com/User/install/web404/
nginx下实现404公益页面
(1)从404公益链接上下载404.html页面
(2)更改nginx监听的网站虚拟主机配置文件,×××.conf,在server定义区域内增加
(2)更改nginx监听的网站虚拟主机配置文件,×××.conf,在server定义区域内增加
- fastcgi_intercept_errors on;
- error_page 404 = /404.html;
- 编辑location定义区域支持404页面呈现
#404公益 fastcgi_intercept_errors on; error_page 404 = /404.html; location = /404.html { root /public_404/html; }
(3)reload nginx
好联系支持404公益
参数说明
(1)fastcgi_intercept_errors : This directive
determines whether or not to transfer 4xx and 5xx errors back to the client or to allow Nginx to answer with directive error_page.
(2)error_page :The directive specifies the URI that will be shown for the errors indicated.