I'm not sure what You mean but I get it that it still does not work ?
I would start out easy without all the ~^'s and so on because if anything can garble up things it's those settings ;-) :
WITHIN the SERVER section :
error_page 403 /403.html; ## need to tell which error You want to catch and what to do (show 403.html)
location = /403.html
{
/etc/nginx/error_pages;
}
error_page 404 /404.html
location = /404.html
{
......
}
and as an example
error_page 500 502 503 504 /50x.html;
location = /50x.html
{
root /etc/nginx/error_pages;
}
and make sure You have a 403.html and a 404.html and a 50x.html page in /etc/nginx/error_pages.
When this works You can start all the concatenating of stuff - then You know where to look if something does not work as expected.
Cheers,