打开配置文件,找到你想自定义错误页面的location块:

location / {
    error_page 404 /404.html;
    # 其它配置
}

确保你有404.html这一文件,如果还想捕捉更多错误,可以这样写:

error_page 404 403 500 /error.html;

这样就完成了,不用再看经典的Nginx默认错误页面了。