参考:http://serverfault.com/questions/196929/reply-with-200-from-nginx-config-without-serving-a-file
用nginx返回200,外加一行字符串,会被当成文件下载,如果不想这样,可以使用这样的配置。
location / {
return 200 'gangnam style!';
# because default content-type is application/octet-stream,
# browser will offer to "save the file"...
# if you want to see reply in browser, uncomment next line
# add_header Content-Type text/plain;
}
即
location / {
return 200 'your json string';
add_header Content-Type text/plain;
}