How can I return a custom JSON body on 404, instead of the default html of: <html> <head> <title>404 Not Found</title> </head> <body bgcolor="white"> <center> <h1>404 Not Found</h1> </center> <hr> <center>nginx</center> </body> </html> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,250033,250033#msg-250033