The initial configuration is as follows, and it turns out that the returned status code is 200, and the following configuration is wrong.
http {
……
fastcgi_intercept_errors on;
……
}
#—————————————-
server{
#It’s just a jump
error_page 404 = /404.html;
}
The correct setting method should be like this (remove the equal sign)
http {
…..
fastcgi_intercept_errors on;
…..
}
#—————————————-
server{
error_page 404 /404.html;
}
Start Nginx smoothly to solve this problem
/usr/local/nginx/sbin/nginx -s reload
When accessing, a custom 404 page appears, and a 404 status code is returned