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 @   xiaohui163  阅读(2250)  评论(0编辑  收藏  举报
编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· .NET Core 中如何实现缓存的预热?
· 三行代码完成国际化适配,妙~啊~
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
点击右上角即可分享
微信分享提示