Actually pretty decent reference Nginx Beginners Guide
Nginx reference, https://nginx.org/en/docs/http/ngx_http_core_module.html#location
location [ = | ~ | ~* | ^~ ] uri { ... }
location @name { ... }
=, ~, ~*, ^~ are all optional parameters
Without any of them, nginx will match request as prefix url, so it can be longer.
= Exact match, stops further searching
~ Regex, case sensitive
~* Regex, case insensitive
^~ Prefix match without following regex
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 = or ^~ is used, regex matching won't be done.
location / {
}
Matches with http://someweb.site/ and any address proceeding the /, so it also matches http://someweb.site/cool/resource.
location /images/ {
}
Matches with http://someweb.site/images and any address proceeding the /images, so it also matches http://someweb.site/cool/resource.
location ~ \.(gif|jpg|png)$ {
root /data/images;
}
~ means the following is a regex. In this case, every address ending on gif, jpg, or png will return a file from /data/images
server {
listen 80;
listen [::]:80;
server_name cloud.lexrudera.net cloud.pulsewave.co;
access_log /var/log/nginx/access-nextcloud80.log;
error_log /var/log/nginx/error-nextcloud80.log;
client_max_body_size 10G;
fastcgi_buffers 64 4k;
location / {
proxy_pass http://192.168.0.102:8080;
}
}
Like to a Gunicorn instance.
server
{
listen 80;
server_name radiotest.kirin.software;
location ~ {
include uwsgi_params;
uwsgi_pass unix:/var/run/uwsgi/radiotest.sock;
}
}