关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

LNMP系列教程:设置404错误页面

发布时间:2013-08-22 00:00:00
 在之前的文章中分享到"设置301重定向的方法"文章,提到301,那肯定也要说说404错误页面吧。因为我们默认安装了LNMP后404页面不会自动设置,也不会默认到程序的404错误页面,而需要我们手工设置。具体如何设置呢?我们一起往下看。   第一步,编辑 /usr/local/nginx/conf/nginx.conf 文件,在http区域添加下面的代码;   fastcgi_intercept_errors on;        第二步,编辑你需要添加404页面的网站的conf文件,对应在 usr/local/nginx/conf/vhost/XXXX.com.conf,在server区域添加代码;   error_page 404 = /404.html;   第三步,重启 LNMP;   /root/lnmp restart   总结,我们可以通过 /usr/local/nginx/sbin/nginx -t 来测试返回状态是否正确。   the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok   configuration file /usr/local/nginx/conf/nginx.conf test is successful   如果是上述返回状态,就是正确的。   本文固定链接: http://www.laozuo.org/215.html | 老左博客

/template/Home/Zkeys/PC/Static