Rumah > Soal Jawab > teks badan
upstream ops {
#ip_hash;
server 5000.ali-bj.cloud.net:10080 weight=2 max_fails=1 fail_timeout=2;
server 5000.ali-sh.cloud.net:10080 weight=1 max_fails=1 fail_timeout=2;
#server 192.168.0.4:5000 max_fails=1 fail_timeout=2;
#server 127.0.0.1:12309;
#server 127.0.0.1:12310;
#server 127.0.0.1:10080 ;
}
----
#web.conf主要配置
location / {
add_header Version v3.1.5.3;
add_header Os QingDao.aliyun.Debian8;
proxy_set_header X-Via QingDao.Aliyun;
proxy_set_header Connection "";
proxy_set_header Host $http_host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://ops;
proxy_cache opscache;
proxy_cache_valid 200 302 5m;
proxy_cache_valid 301 1h;
proxy_cache_valid any 1m;
}
Penerangan:
5000.ali-bj.cloud.net/5000.ali-sh.cloud.net 域名都是解析到同一个ip(192.168.1.124)上的
Lawati nama domain 502:
2017/04/03 11:26:14 [error] 408#408: *1 upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.105, server: dev.cloud.net, request: "GET / HTTP/1.1", upstream: "http://192.168.1.124:10080/", host: "dev.cloud.net"
Bolehkah nginx upstream melakukan pengimbangan beban berdasarkan nama domain? Walaupun selepas menetapkan Hos $http_host, ia masih sama
给我你的怀抱2017-05-16 17:10:23
Jelas sekali nginx menyokong hos maya! Kemudian hos maya yang berbeza boleh menentukan huluan yang berbeza!