shameless self-plug
I've set up something similar on my personal domain, except that it outputs JSON only if it's a curl request (i.e. if the user agent begins with curl) while browsing to it using a regular browser serves the actual website:
$ curl kamal.io
nginx config: http://pastebin.com/VBuYPHbT