nginx 查看 $1,$2,$3
前言nginx version: nginx/1.18.0CentOS Linux release 7.6.1810 (Core)nginx 查看 $1,$2,$3匹配正则表达式时,匹配到的值通过$1、$2、$3、…、$9使用。location ~* /out/(.*) {default_type text/html ;return 200 "hello, $1";}location ~* /ou
·
前言
- nginx version: nginx/1.18.0
- CentOS Linux release 7.6.1810 (Core)
nginx 查看 $1,$2,$3
匹配正则表达式时,匹配到的值通过$1、$2、$3、…、$9使用。
location ~* /out/(.*) {
default_type text/html ;
return 200 "hello, $1";
}
location ~* /out2/(.*)/(.*) {
default_type text/html ;
return 200 "var1 = $1, var2 = $2";
}
-
当请求为
“/out/zhangsan”
时, 效果如图:
-
当请求为
“/out/zhangsan/lisi”
时, 效果如图:
-
当请求为
“/out2/zhangsan/lisi”
时, 效果如图:
更多推荐
已为社区贡献42条内容
所有评论(0)