zoukankan      html  css  js  c++  java
  • nginx 设置来源IP固定请求后端接口

    nginx 配置 设置IP请求到固定后端接口

    nginx 配置示例:

    server {
        listen   80;
        access_log   /var/log/nginx/access.log;
     
        location / {
            proxy_ignore_client_abort on;
            proxy_read_timeout 200s;
            proxy_redirect    off;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto  $scheme;
            client_max_body_size    1000m;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
     
            if ($remote_addr ~ "172.16.2.53")
            {
                proxy_pass    http://client3;
                break;
            }
     
            if ($remote_addr ~ "172.16.2.54")
            {
                proxy_pass    http://client4;
                break;
            }
     
            proxy_pass    http://client5;
        }
    }
    upstream client3 {
        server 172.16.2.53:8080 max_fails=5 fail_timeout=10;
    }
     
    upstream client4 {
        server 172.16.2.54:8080 max_fails=5 fail_timeout=10;
    }
     
    upstream client5 {
        server 172.16.2.55:8080 max_fails=5 fail_timeout=10;
    }
  • 相关阅读:
    CHOCBase
    iOS 12中无法获取WiFi的SSID了?
    如何打开Assets.car文件
    博客园美化资源网站链接
    xcode工程配置绝对路径与相对路径
    UIControl事件
    UIButton属性
    UIAlertView
    UIActivityIndicatorView
    NSAttributedString
  • 原文地址:https://www.cnblogs.com/sharesdk/p/12124863.html
Copyright © 2011-2022 走看看