Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replace nginx errors

Tags:

nginx

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


like image 950
Naomi Avatar asked May 10 '11 13:05

Naomi


People also ask

How do I fix 403 Forbidden Nginx?

However, if the specified index files are not in the directory, Nginx will return 403 forbidden error. One way to resolve this issue is to add the index file specified in the configuration file or add the available index file to the config file.


1 Answers

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;
    # ...
}
like image 129
yibe Avatar answered Sep 24 '22 06:09

yibe