geo $remote_addr $geo {
default 0;
127.0.0.1 1;
}
geo $arg_ttlsa_com $geo {
default 0;
127.0.0.1 1;
}
geo $country {
default ZZ;
include conf/geo.conf;
delete 127.0.0.0/16;
proxy 192.168.100.0/24;
proxy 2001:0db8::/32;
127.0.0.0/24 US;
127.0.0.1/32 RU;
10.1.0.0/16 RU;
192.168.1.0/24 UK;
}
vim conf/geo.conf
10.2.0.0/16 RU; 192.168.2.0/24 RU;
geo $country {
ranges;
default ZZ;
127.0.0.0-127.0.0.0 US;
127.0.0.1-127.0.0.1 RU;
127.0.0.1-127.0.0.255 US;
10.1.0.0-10.1.255.255 RU;
192.168.1.0-192.168.1.255 UK;
}
shell $> cd /usr/local/nginx/html shell $> rm index.html shell $> echo "192.168.6.101" > index.html
shell $> cd /usr/local/nginx/html shell $> rm index.html shell $> echo "192.168.6.102" > index.html
shell $> /usr/local/nginx/sbin/nginx
shell $> cd /usr/local/nginx/conf/ shell $> vim nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
geo $geo {
default default;
192.168.6.189/32 uk;
192.168.6.8/32 us;
#这里的子网码是 32 是因为,我是单网段测试,如果你有VLAN,你可以是24 例如
# 192.168.0.0/24 tw
}
upstream uk.server {
server 192.168.6.101;
}
upstream us.server {
server 192.168.6.102;
}
upstream default.server {
server 192.168.6.121:8080;
}
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name 192.168.6.121;
index index.html index.htm;
root html;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://$geo.server$request_uri;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 8080;
server_name 192.168.6.121;
location / {
root html;
index index.html index.htm;
}
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有