1.1.1.
URL matching rules
Matching rule Configuration Summary:
Location [=|~|~*|^~]/uri/{}
Priority level |
Matching method |
Describe |
1 Maximum |
= |
Exact match. |
2 |
^~ |
Start with a string, pure string, regular expression not supported |
3 |
~* |
Regular expression matching, case-insensitive |
3 |
~ |
Regular expression matching, case-sensitive |
3 |
!~* |
Regular expressions do not match, case-insensitive |
3 |
!~ |
Regular expression mismatch, case-sensitive |
4 min |
/ |
Generic match, matching all paths that do not match the preceding criteria |
when multiple location nodes with the same priority match the URL of a request , the top matching success occurs in the configuration file.
1.1.2.
configuration of the actual path
in processing URL requests, there are many different configurations for the corresponding actual paths.
How to configure |
Describe |
Root |
Nginx Root of the server, default to html catalogue. For example: location/abc/ Root /opt/nginx/html Request: /abc/1.txt Actual path: /opt/nginx/html/abc/1.txt |
Alias |
The root directory of the Nginx server will remove that part of the location. Alias can use regular expressions, you can use The grouping $1,$2,$3 in the location regular expression , and so on. location/abc/ Alias/opt/nginx/html Request:/abc/1.txt Actual path: /opt/nginx/html/1.txt |
Index |
Define the first page. You can separate multiple home files with spaces. Index index.html index.jsp index.php |
Error_page |
Error page redirection. Multiple redirection methods. |
Nginx Learning Notes 04URL matching rules and actual paths