Using variables in Nginx location rules

前端 未结 4 510
自闭症患者
自闭症患者 2020-12-12 17:54

In Nginx, I\'m trying to define a variable which allows me to configure a sub-folder for all my location blocks. I did this:

set $folder \'/test\';

location         


        
4条回答
  •  误落风尘
    2020-12-12 18:40

    You could do the opposite of what you proposed.

    location (/test)/ {
       set $folder $1;
    }
    
    location (/test_/something {
       set $folder $1;
    }
    

提交回复
热议问题