candy 发表于 2018-11-8 07:17:47

Nginx的location区块的作用及设置

location = / { [ configuration A ] }                     #用户请求"/"时,匹配A,例如:www.pcm.com/  
location / { [ configuration B ] }                     #当用户请求"/index.html"时,匹配B,例如:www.pcm.com/index.html
  
location /documents/ { [ configuration C ] }             #当用户请求"/documents/"时,匹配C,例如:www.pcm.com/documents/index.html
  
location ^~ /images/ { [ configuration D ] }             #当用户请求"/images/"时,匹配D,:www.pcm.com/images/1.jpg
  
location ~* \.(gif|jpg|jpeg)$ { [ configuration E ] }    #当用户请求".gif|.jpg|.jpeg"时,匹配E,例如:www.pcm.com/documents/1.jpg
  
                                                         #上面的反斜杠是转义字符,$的意思是结尾


页: [1]
查看完整版本: Nginx的location区块的作用及设置