 # This is an NGINX configuration file written and used by me in order to map HTTP errors to static HTML pages.
 #
 # (c) Corrado Mulas <tlc@mulas.me>
 #
 # For the full copyright and license information, please view the LICENSE
 # file that was distributed with this source code.

   # error_page 503 /main.html;
   # location = /maint.html {
   #     root /var/www/;
   # }

###########	4xx	##########################

        error_page 401 @error41;
        location @error41 {
                root /var/www/errors;
                rewrite ^(.*)$ /401.html break;
        }

        error_page 403 @error43;
        location @error43 {
                root /var/www/errors;
                rewrite ^(.*)$ /403.html break;
        }

        error_page 404 @error44;
        location @error44 {
                root /var/www/errors;
                rewrite ^(.*)$ /404.html break;
        }

###########	5xx	###########################à

        error_page 500 @error50;
        location @error50 {
                root /var/www/errors;
                rewrite ^(.*)$ /500.html break;
        }

        error_page 502 @error52;
        location @error52 {
                root /var/www/errors;
                rewrite ^(.*)$ /502.html break;
        }

        error_page 503 @error53;
        location @error53 {
		root /var/www/errors;
                rewrite ^(.*)$ /503.html break;
        }

        error_page 504 @error54;
        location @error54 {
                root /var/www/errors;
                rewrite ^(.*)$ /504.html break;
        }