我有一个问题,在我的理解中,有一个优雅的解决方案,但我找不到它:
https://appB-branchY.domain.org/index.html
domain.org
本地文件系统/opt/domain/frontend/appN
https://storage.org/appN/branchZ
我对主机domain.org的当前nginx配置如下:
server {
listen 443;
server_name ~^(?<app>(appA|appB|appC)?)-(?<branch>.+?)\.domain\.org$;
# I want to send to storage_upstream only requests with ^/frontend/$app URL
# but don't know how.
location ~ ^/frontend/ {
rewrite ^/frontend/(.*)$ /$app/$branch/frontend/$1 break;
proxy_pass https://storage_upstream;
}
我无法在$app
中使用location ~ ^/frontend/
变量,但如何仅将包含网址^/frontend/$app
的请求发送到上游的storage_upstream
?