引入的文件如下:
代码语言:javascript复制/diy/abc "{"name":1}";
/diy/bcd "{"name":999}";
/logout/11 "123";
/logout/22 "{"name":9199}";
Nginx配置
代码语言:javascript复制http {
map $request_uri $response {
include /Users/zanglikun/Desktop/urlAndResponse.txt;
default "";
}
server {
listen 8080;
server_name localhost;
#charset koi8-r;
access_log /Users/zanglikun/Desktop/nginxlog.log mylog;
location / {
root html;
index index.html index.htm;
if ($response = "") {
return 404;
}
add_header Content-Type application/json;
return 200 $response;
}
include servers/*;
}
尽管结果是