• nginx分流配置


    user  nginx;
    worker_processes  1;
    error_log  /var/log/nginx/error.log warn;
    pid        /var/run/nginx.pid;
    events {
        worker_connections  1024;
    }
    http {
        include       /etc/nginx/mime.types;
        default_type  application/octet-stream;
    
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
    
        access_log  /var/log/nginx/access.log  main;
        sendfile        on;
        #tcp_nopush     on;
        keepalive_timeout  65;
        #gzip  on;
    geo $remote_addr $geo {
         default 0;
    #     10.0.0.66/32 1;
         10.0.0.65/32 2;
         10.0.0.0/24 3;
      }
    upstream server_65 {
      server 10.0.0.65:80;
      }
    upstream server_66 {
      server 10.0.0.66:80;
      }
    server {
         listen      80 default_server;
         listen       [::]:80 default_server;
         server_name  _;
         root         /usr/share/nginx/html;
        if ($geo = 1) {
            #return 200 'this is for 10.0.0.66';
            proxy_pass http://server_66;
            }
        if ($geo = 2) {
            #return 200 'this is for 10.0.0.65';
            proxy_pass http://server_65;
            }
        if ($geo = 3) {
            #return 200 'this is for 10.0.0.0/24';
               }
    

    微信赞赏

    支付宝赞赏

  • 相关阅读:
    闲谈随笔以及对自己的心里暗示
    java利用Scanner获取键盘输入
    【积累】发送验证码按钮倒计时js
    【积累】validate验证框架的使用
    重写toString()方法来描述一个类
    【java基础】 合并两个类型相同的list
    java单例类/
    基本类型的包装类
    强转
    【java基础】面向对象的三大特征---多态
  • 原文地址:https://www.cnblogs.com/superlinux/p/15125781.html
Copyright © 2020-2023  润新知