1

I have researched online for a means to change the error page when running into a 502 Bad Gateway error. I have tried all the methods given to no avail. I looked in the nginx.conf file and saw that it points to /usr/share/nginx/html/50x.html when dealing with 500 errors. However this page is never shown. Instead it shows

502 Bad Gateway


nginx/1.16.1

What am I missing?

I followed this guide https://blog.adriaan.io/one-nginx-error-page-to-rule-them-all.html

And others, but I am beginning to think that there is another issue altogether that is bypassing my code.

Seth Boland
  • 11
  • 1
  • 2

2 Answers2

0

I have a same example for that case. But, there is important thing, after I write internal for 50x.html path, it should be exist file named 50x.html in the given directory!

error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root /var/www/technical/maintenancy;
    internal;
}

I would also give advice to check nginx error.log where it located in /var/log/nginx directory!

0

Sample example is below, kindly change paths and names accordingly.

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    error_page 500 502 503 504 /custom_50x.html;
    location = /custom_50x.html {
            root /usr/share/nginx/html;
            internal;
    }}
asktyagi
  • 3,038