Nginx it’s a very powerful reverse proxy.

Sometimes if we have a service redirected by ngnix that is down is not a good practice leave the default error page of Nginx. The reasons of why change the default error page of ngnix are a lot:

  • Hide the reverse proxy technology
  • Show a custom page for each error or service
  • Manifest professionally\

Configuration:

  • Open the “/etc/nginx/sites-enabled/default” configuration file
  • Inside the “server” element put a code like that:
error_page 502 /maintenance.html;
location = /maintenance.html {
      root  /var/www;
}

In this case we are mapping the 502 error code to the maintenance page under “/var/www”

Remember to put the right permission on the file and the folder,otherwise you will get an 403-Forbidden error.

ENJOY!!!!