Set Nginx custom 404 error page and return 404 status code

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

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索