From 8b917ac11414245392bb9231f5fcce647b56f37e Mon Sep 17 00:00:00 2001 From: Peter Mekhaeil <4616064+petermekhaeil@users.noreply.github.com> Date: Mon, 18 Sep 2023 22:24:56 +0800 Subject: [PATCH] Create nginx-nested-locations.md --- learnings/nginx-nested-locations.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 learnings/nginx-nested-locations.md diff --git a/learnings/nginx-nested-locations.md b/learnings/nginx-nested-locations.md new file mode 100644 index 0000000..d85409d --- /dev/null +++ b/learnings/nginx-nested-locations.md @@ -0,0 +1,21 @@ +# Nginx Nested Locations + +``` +server { + location /app { + location /app/assets { + # ... + } + + location /app/pages { + # ... + } + } +} +``` + +Nested locations are not relative to the parent location. + +- `location /app` parent location block that matches requests starting with `/app`. +- `location/app/assets` nested location that matches `/app/assets`. +- `location/app/pages` nested location that matches `/app/pages`.