xixi

nginx location指令

2017/02/14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
location = / {
[ configuration A ]
}
location / {
[ configuration B ]
}
location /documents/ {
[ configuration C ]
}
location ^~ /images/ {
[ configuration D ]
}
location ~* \.(gif|jpg|jpeg)$ {
[ configuration E ]
}
  • configuration A 精确匹配 path=/
  • configuration B 匹配 path=/* 如 /index.html
  • configuration C 匹配 path=/documents/* 如 /documents/document.html
  • configuration D 正则唯一匹配 path=/images/* 如 /images/1.gif
  • configuration E 正则不区分大小写匹配 *.(gif|jpg|jpeg) 如 /documents/1.jpg
CATALOG