LNMP最新教程之如何设定404错误error页面

上海手表回收这个网站被百度检查出很多死链接,如果不修改死链接的话对搜索引擎的曝光率是很不利的,那如何修改呢?

第一步,编辑/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

如果是上述返回状态,就是正确的。


猜你喜欢

转载自blog.csdn.net/qq_41200875/article/details/80542364