Last active
June 29, 2019 08:07
-
-
Save SherryQueen/cebc2e17c22b31073e790393fdda119a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| listen 80; # 监听80端口 | |
| server_name your_domain; # 监听的域名 | |
| # 挂载的应用1 | |
| # ^~ 表示匹配后不再向下寻找 | |
| location ^~ /app1 { | |
| alias /data/app1; # 应用所在文件地址, alias 表示所有查询以对应的相对路径开始进行 | |
| index index.html inde.htm; # 默认的 index 文件 | |
| try_files $uri $uri/ /index.html =404 # 尝试寻找对应的文件. 根据 /app1/xxx 中的 /alias/xxx 进行查询匹配, 若未匹配到 返回 /index.html 若无 则 返回 404状态 | |
| } | |
| # 挂载的应用2 | |
| location ^~ /app2 { | |
| alias /data/app2; | |
| index index.html index.htm; | |
| try_files $uri $uri/ /index.html =404 | |
| } | |
| # Match url, return the corresponding file | |
| location ~* ^\/([a-z]+)\/branch\/(.*)$ { | |
| add_header arg_one $1; | |
| add_header arg_two $2; | |
| add_header args_three $3; | |
| root /data/**/$1/releases/$2/; | |
| index index.html; | |
| try_files $3 $uri $uri/ /index.html =404; | |
| } | |
| location ~* ^\/([a-z]+)(.*)$ { | |
| add_header a_one $1; | |
| add_header a_two $2; | |
| root /data/**/$1/current/; | |
| index index.html; | |
| try_files $2 $uri $uri/ /index.html =404; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment