NGINX 拦截指定请求并返回json数据

以api xx.xxx.com/xxx/aaa/api 为例:

hosts将域名指向本地
127.0.0.1 xx.xxx.com

nginx构造下路径

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

你可能感兴趣的:(nginx,json,java)