nginx
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| nginx [2026/01/07 00:17] – [Reference Notes] lex | nginx [2026/01/08 00:39] (current) – lex | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| ===== Reference Notes ===== | ===== Reference Notes ===== | ||
| Actually pretty decent reference [[https:// | Actually pretty decent reference [[https:// | ||
| - | === location === | + | ==== location ==== |
| + | Nginx reference, [[https:// | ||
| + | < | ||
| + | location [ = | ~ | ~* | ^~ ] uri { ... } | ||
| + | location @name { ... } | ||
| + | </ | ||
| + | '' | ||
| + | |||
| + | Without any of them, nginx will match request as prefix url, so it can be longer.\\ | ||
| + | '' | ||
| + | '' | ||
| + | '' | ||
| + | '' | ||
| + | === Logic === | ||
| + | Nginx divides it into prefix locations and regex locations. It starts going through prefix locations, selecting the longest that matches. With that selection, nginx runs through the regex matches. If '' | ||
| + | |||
| + | === Examples === | ||
| < | < | ||
| location / { | location / { | ||
| - | root /data/www; | ||
| } | } | ||
| </ | </ | ||
| - | / refers to the URI, so in this case the root URI\\ | + | Matches with '' |
| - | So the above returns files in ''/ | + | |
| < | < | ||
| location /images/ { | location /images/ { | ||
| - | root /data; | ||
| } | } | ||
| </ | </ | ||
| - | Returns files in /data/images/ | + | Matches with '' |
| < | < | ||
nginx.1767745078.txt.gz · Last modified: by lex
