nginx 设置 404 500 页面跳转到指定页面

nginx 设置 404 500 页面跳转到指定页

默认情况下 nginx 是不支持自定义 500 、400 页面;

修改配置文件  conf/nginx.conf  添加页面重定向,在 http 内添加一行;

fastcgi_intercept_errors on;

在 service  内添加一行指定测错误页面

error_page 404 500   = /error.html;  或者

error_page 404 = http://你的域名;      【提醒这里要写http

然后测试一下:

你的安装目录/nginx/sbin/nginx –t 
你的安装目录/nginx/sbin/nginx -s reload

原文地址:https://www.cnblogs.com/dafei4/p/12939148.html