Naomi
Naomi

Reputation: 97

How to replace nginx errors

Is it possible to replace 502 errors on nginx.conf (php-fpm problems), with 503?

502 = bad gateway

503 = server overloaded


nginx: 502

googlebot: Hmmm, I don't like that... sorry but... penalized...


nginx: 503

googlebot: Hmmm, no problem, I will try again later...

nginx: thank you for your willingness to understand


Upvotes: 8

Views: 1976

Answers (1)

yibe
yibe

Reputation: 4109

Make sure fastcgi_intercept_errors is set to on, and use the error_page directive:

location / {
    fastcgi_pass 127.0.0.1:9001;
    fastcgi_intercept_errors on;
    error_page 502 =503 /error_page.html;
    # ...
}

Upvotes: 6

Related Questions