nginx代理tomcat应用时,使用nginx error-page代理服务器的错误页面
打开编辑 nginx/config/nginx.config
在server中、与location {} 平级:
示例:
server{
proxy_intercept_error on; #这句
recursive_error_pages on; #这句
error_page 400 http://127.0.0.1/errorpage.html; #errorPageUrl
error_page 403 http://127.0.0.1/errorpage.html; #errorPageUrl
location / {
proxy_pass http://127.0..0.1:8088;
.....
...
..
.
}
}
重启nginx 成功。
这样弄完后,会屏蔽掉TomCat 的服务400 403 报错;我是这样配置的,测试有用。