How to Configure Nginx reverse proxy the domain
未测试过,自己记录待用
http {
resolver 8.8.8.8;
upstream example {
server http://example.com resolve [use_last] ...;
keepalive 1024;
}
第二种负载均衡
upstream mytarget{
server aaa.tar.com:443 max_fails=3 fail_timeout=60s;
server bbb.tar.com:443 backup;
}
server {
listen 80;
server_name aaa.tar.com bbb.tar.com;
resolver 8.8.8.8 valid=10s ipv6=off;
location /login/{
proxy_set_header Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
set $cmpassport_addr https://mytarget/my_target/login;
proxy_pass $cmpassport_addr;
}