Setting up custom error pages are needed whenever the app goes in maintenance or when the code gets crashed :P … In Nginx, its fairly simple but once when you know it.

Say your app example.com is residing in /var/www/apps/example

Nginx configurations

say your existing configuration looks like…

add the error page configurations

Create the required html error page at /var/www/maintenance/example/500.html.
Now, restart the nginx to reload the configurations by issuing /etc/init.d/nginx restart.
And you are done!

Share this: