Home  >  Q&A  >  body text

apache - About Nginx handling 502 errors

Hi
I encountered a problem, that is, I used Nginx in the front and apache in the back.

But sometimes when apache restarts (assuming the restart is not smooth), nginx will immediately return 502.

How to make nginx connect to the backend (such as apache), if the backend is in an unresponsive state, or is not started, Nginx will retry N times and return 502?

Instead of returning 502 immediately, thank you!

某草草某草草2713 days ago522

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-05-16 17:00:41

    nginx reverse proxy cannot find apache and will definitely report a 502 error. The service is unavailable at this time. Even if the error is reported after retrying n times, the service will hang during the retry process, but the 502 error will not be displayed.
    I think what you want is not to display a 502 error even if nginx makes an error. So, is it okay to directly block the 502 error?

    reply
    0
  • Cancelreply