您的位置:首页 > 运维架构 > Nginx

Reply with 200 from Nginx config without serving a file

2016-12-14 15:37 477 查看
参考: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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nginx return return-200