nginx返回特定字符串

 

1、返回文本

location ~ ^/get_text {
    default_type text/html;
    return 200 'This is text!';  
}

2、返回json

location ~ ^/get_json {
    default_type application/json;
    return 200 '{"status":"success","result":"nginx json"}';
}

 

posted @ 2020-10-12 13:28  wjl910  阅读(3301)  评论(0)    收藏  举报