Nginx try_files (folders + files) fallback

前端 未结 1 886
眼角桃花
眼角桃花 2021-01-18 02:28

Given this folder structure:

root folder
    + default
        + settings1.txt
        + settings2.txt
        ...
        + settingsN.txt
    + user00001
           


        
相关标签:
1条回答
  • 2021-01-18 02:39
    location ~ ^(/[^/]+)(/.+)$ {
      root ...;
      if (!-d "$document_root$1") {
        return 404;
      }
      try_files $1$2 /default$2 =404;
    }
    
    0 讨论(0)
提交回复
热议问题