V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
andybest
V2EX  ›  问与答

如何设置可以显示 Nginx 本身的错误信息?

  •  
  •   andybest · Jan 15, 2015 · 3014 views
    This topic created in 4127 days ago, the information mentioned may be changed or developed.
    生产服务器上,前端 Nginx 使用配置:

    proxy_pass http://127.0.0.1:8080;

    代理 8080 端口上的 tomcat / jetty

    目前如果是脚本错误,会显示出 tomcat / jetty 的 500 错误信息,
    我打算在不修改 tomcat / jetty 配置的前提下,让 Nginx 截获 500 错误信息,并显示 Nginx 本身设置的 500 错误信息,应该如何做呢?
    2 replies    2015-01-15 07:39:22 +08:00
    Lax
        1
    Lax  
       Jan 15, 2015   ❤️ 1
    try this.
    proxy_intercept_errors on;
    sangev5
        2
    sangev5  
       Jan 15, 2015   ❤️ 1
    server {
    listen 80;
    error_page 500 /500.html;
    error_page 502 /502.html;
    error_page 503 /503.html;
    error_page 504 /504.html;

    location /test {
    return 502;
    }
    }
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2454 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 10:16 · PVG 18:16 · LAX 03:16 · JFK 06:16
    ♥ Do have faith in what you're doing.