如何基于Nginx+GeoIP实现跨国流量调度?

提问者:帅平 问题分类:运维
如何基于Nginx+GeoIP实现跨国流量调度?
1 个回答
空瓶在漂流
空瓶在漂流
GeoIP数据库配置
geoip_country /usr/share/GeoIP/GeoIP.dat;
map$geoip_country_code$backend {
    default  us.web.service;  # 默认美国集群
    CN       cn.web.service;  # 中国用户
    JP       jp.web.service;  # 日本用户
}
server {
    location / {
        resolver8.8.8.8 valid=30s;  # 动态DNS解析
        proxy_pass http://$backend;
        proxy_next_upstreamerror timeout http_500;
    }
}
发布于:5天前 IP属地:四川省
我来回答