lnmp之nginx如何设置404错误页面
1.创建自己的404.html页面
2.更改nginx.conf在http定义区域加入:
fastcgi_intercept_errors on;
3.更改nginx.conf或虚拟主机的域名.conf在server 区域加入:
error_page 404 /404.html;
4.测试nginx.conf正确性:
/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
发表评论 取消回复