Efficiently defining many nginx custom error pages

Solution 1:

When you don't map each error page to it's own location you can do with a single location directive:

error_page 402 /error/402.html;
error_page 403 /error/403.html;
error_page 404 /error/404.html; 
... etc. 

location = /error/ {
        alias /usr/share/nginx/errors/;
}