简体   繁体   中英

Nginx - Search for static content in multiple directories?

Because of the way that our git repos are setup I have some static content that might be in one directory - and other content that might be in another directory. How can I ask nginx to search in two places for a static file like a stylesheet?

I originally thought that try_files had my answer - but I can't seem to get it to work.

try_files $uri /dir1/static/$uri /dir2/static/$uri @missing;
location ~* ^/just_test/(.+)$ {
    root /some/path/to/web/root;
    try_files /just_test/1/$1 /just_test/2/$1 /just_test/3/$1 @missing;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM