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目录下

posted @ 2015-08-18 11:30  xiaohui163  阅读(2247)  评论(0编辑  收藏  举报