Kek, just realised that you can actually use map directive to declare variables in http block. :)

This commit is contained in:
Alexander Andreev 2021-11-15 04:01:04 +04:00
parent 98b38376b5
commit 4fd1d46a30
Signed by: Arav
GPG Key ID: 610DF2574456329F

View File

@ -55,3 +55,9 @@ block article
| location /assets/ { | location /assets/ {
| alias $root/homepage/static/assets/; | alias $root/homepage/static/assets/;
| } | }
p The very reason why I had to use variables is that #[code alias] doesn't work with relative paths. I wish #[code alias] could be relative to #[code root], but we are forced to look for workarounds.
p Update: Oh, I realised that you can declare variables in #[code http] block using #[code map] directive with #[code default] set to value you need. Funny, I've been using #[code map] to prevent LAN IPs from being logged all this time, heh. So, here's example:
pre
| map 1 $root {
| default /srv/http/dwelling;
| }