这是我们当前的 nginx 配置。它将 redquests 转发到 TeamCity 实例上的根资源。
server {
listen 80;
server_name ci.mycompany.com;
client_max_body_size 100M;
location / {
proxy_pass http://127.0.0.1:8111;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header X-Forwarded-For $remote_addr;
}
}
我想公开一个文件夹/myfiles
- 不将其发送给 Team City。我该怎么做?
答案1
对于低优先级位置前缀,始终以最长匹配为优先:
server {
listen 80;
server_name ci.mycompany.com;
client_max_body_size 100M;
location / {
proxy_pass http://127.0.0.1:8111;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header X-Forwarded-For $remote_addr;
}
location /myfiles {
#do something here
}
}