现有服务器有两台: a.https://172.16.100.143:8443/t1 a.https://172.16.100.143:8443/g2
b.https://172.16.100.143:8443/t1 b.https://172.16.100.143:8443/g2
upstream t {
server 172.16.100.143:8443 weight=1;
server 172.16.100.144:8443 weight=2;
location ~ ^/t1(/?)(.*){
proxy_pass https://t
proxy_read_timeout 30;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
root html;
index index.html index.htm;
client_max_body_size 20m;
}
location ~ ^/g2(/?)(.*){
proxy_pass https://t;
proxy_read_timeout 30;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
root html;
index index.html index.htm;
client_max_body_size 20m;
}
如今效果似乎只代理到了 8443,而后面的目录没有代理到,求解
1
Senorsen 2016-09-06 22:03:34 +08:00 via Android
这个看着并不需要正则匹配,用`location /g2 `这样试试?
|
2
akira 2016-09-06 22:04:43 +08:00
源目录保持过去? 那就没必要 写 2 个 location 了啊
|
4
popphen OP 更换 tengine 后解决
|