Created
January 20, 2016 12:05
-
-
Save huangguozhen/7c755a89b333717f0e84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. alias | |
``` | |
context: location | |
``` | |
Defines a replacement for the specified location. For example, with the following configuration | |
location /i/ { | |
alias /data/w3/images/; | |
} | |
on request of “/i/top.gif”, the file /data/w3/images/top.gif will be sent. | |
The path value can contain variables, except $document_root and $realpath_root. | |
If alias is used inside a location defined with a regular expression then such regular expression should contain captures and alias should refer to these captures (0.7.40), for example: | |
location ~ ^/users/(.+\.(?:gif|jpe?g|png))$ { | |
alias /data/w3/images/$1; | |
} | |
When location matches the last part of the directive’s value: | |
location /images/ { | |
alias /data/w3/images/; | |
} | |
it is better to use the root directive instead: | |
location /images/ { | |
root /data/w3; | |
} | |
2 location | |
``` | |
Syntax: location [ = | ~ | ~* | ^~ ] uri { ... } | |
location @name { ... } | |
Default: — | |
Context: server, location | |
``` | |
正则匹配~* (不区分大小写) | |
正则匹配~ (区分大小写) | |
最大路径匹配 = 和 ^~ | |
如果查找到^~就不再继续匹配 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment