Ubuntu nginx 配置404错误页面
Ubuntu18.04 nginx 当然其他版本的也差不多
1.创建404页面;
2.更改nginx.conf(我的安装目录是/etc/nginx/)在http定义区域加入:
fastcgi_intercept_errors on;
3.更改/etc/nginx/sites-enabled/default 文件;
server定义区域中添加:
error_page 404 /404.html;
location = /404.html {
root /var/www/html;
}
记得把404页面修改为你的404页面的路径
4.测试nginx.conf正确性:
nginx –t
测试成功页面
5.重启nginx:
service nginx restart
完毕!