nginx 配置错误页面


server {

...

include 404.conf;

...

}

vi 404.conf

proxy_intercept_errors on;
error_page 404 @404;
error_page 503 @503;
error_page 502 @502;
error_page 403 @403;
error_page 500 @500;
location @404 {
root html;

rewrite (.*) /error.html break;
}
location ^~ /wdzj_404.png {
root html;
}
location @503 {
root html;
rewrite (.*) /503.html break;
}
location ^~ /wdzj_503.png {
root html;
}
location @403 {
root html;
rewrite (.*) /403.html break;
}
location ^~ /wdzj_403.png {
root html;
}

location @502 {
root html;
rewrite (.*) /502.html break;
}
location ^~ /wdzj_502.png {
root html;
}
location @500 {
root html;
rewrite (.*) /502.html break;
}

 

#以上404.conf  40*.html,50*.html,wdzj_*.png 这些文件都在前端的nginx目录下的html目录下


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM