本文共 1141 字,大约阅读时间需要 3 分钟。
Nginx return ?????????????????????????????return ???????????????????? server?location ?? if ??????
return ???????????????????????????URL ??????
??1?
server { listen 80; server_name www.aming.com; return 403; rewrite /(.*) /abc/$1; // ??????????} ??2?
server { listen 80; server_name www.aming.com; if ($request_uri ~ "\.htpasswd|\.bak") { return 404; rewrite /(.*) /aaa.txt; // ?????????? } // ????????} ???????????????????????? JSON ?????????
??3?
server { listen 80; server_name www.aming.com; return 200 "hello;";} ??4?
location ^~ /aming { default_type application/json; return 200 '{"name":"aming","id":"100"}';} ??5?
location /test { return 200 "$host $request_uri";} return ??????????? URL???? URL ? http:// ? https:// ???
??6?
server { listen 80; server_name www.aming.com; return http://www.aminglinux.com/123.html; rewrite /(.*) /abc/$1; // ??????????} ?????????????????????????
if ($http_referer ~ 'baidu.com') { return 200 "";} ?????
return http://$host$request_uri;??????????????????????????????????????转载地址:http://ucti.baihongyu.com/