nginx
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| nginx [2026/01/06 18:28] – created lex | nginx [2026/01/08 00:39] (current) – lex | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Nginx Things ====== | ====== Nginx Things ====== | ||
| + | ===== Reference Notes ===== | ||
| + | Actually pretty decent reference [[https:// | ||
| + | ==== 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 / { | ||
| + | } | ||
| + | </ | ||
| + | Matches with '' | ||
| + | |||
| + | < | ||
| + | location /images/ { | ||
| + | } | ||
| + | </ | ||
| + | Matches with '' | ||
| + | |||
| + | < | ||
| + | location ~ \.(gif|jpg|png)$ { | ||
| + | root / | ||
| + | } | ||
| + | </ | ||
| + | ~ means the following is a regex. In this case, every address ending on gif, jpg, or png will return a file from / | ||
| + | ===== Examples ===== | ||
| + | ==== Basic Proxy Pass ==== | ||
| + | < | ||
| + | server { | ||
| + | listen 80; | ||
| + | listen [::]:80; | ||
| + | |||
| + | server_name cloud.lexrudera.net cloud.pulsewave.co; | ||
| + | |||
| + | access_log / | ||
| + | error_log / | ||
| + | |||
| + | client_max_body_size 10G; | ||
| + | fastcgi_buffers 64 4k; | ||
| + | |||
| + | location / { | ||
| + | proxy_pass http:// | ||
| + | } | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | |||
| + | ==== Basic UWSGI Pass ==== | ||
| + | Like to a Gunicorn instance. | ||
| + | < | ||
| + | server | ||
| + | { | ||
| + | listen 80; | ||
| + | server_name radiotest.kirin.software; | ||
| + | |||
| + | location ~ { | ||
| + | include uwsgi_params; | ||
| + | uwsgi_pass unix:/ | ||
| + | } | ||
| + | } | ||
| + | |||
| + | </ | ||
nginx.1767724106.txt.gz · Last modified: by lex
