LNMP一键安装包默认是没有配置404页面的,军哥也在他的网站上写了方法了,如果需要404页面,请参考以下方法:
这个是需要修改该网站的Nginx的conf配置文件:
1、如果配置文件中定义区不存在以下条目,请添加:
fastcgi_intercept_errors on;
2、创建404.html文件,要求大于512字节;
3、更改nginx.conf或虚拟主机的域名.conf在server 区域加入:
error_page 404 /404.html;
4、运行以下命令测试Nginx配置文件是否正确;
/usr/local/nginx/sbin/nginx -t
正常应该回显
the configuration file /opt/nginx/conf/nginx.conf syntax is ok configuration file /opt/nginx/conf/nginx.conf test is successful
5、运行以下命令重启Nginx
/usr/local/nginx/sbin/nginx -s reload
来源:军哥写的教程。
本文作者为Nicky,转载请注明。