zoukankan      html  css  js  c++  java
  • Nginx support TCP Load balance

    1. Install nginx package

    2. edit nginx configuration file

    [root@ip-10 nginx]# more nginx.conf
    
    user  nginx;
    worker_processes  auto;
    
    error_log  /var/log/nginx/error.log notice;
    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;
    
        include /etc/nginx/conf.d/*.conf;
    }
    
    
    # TCP/UDP proxy and load balancing block
    
    stream {
        # Example configuration for TCP load balancing
    
        upstream stream_ota {
            zone tcp_servers 64k;
            server 10.xx.xx.32:22;
            server 10.xx.xx.12:22;
        }
    
        server {
            listen 2222;
            status_zone tcp_server;
            proxy_pass stream_ota;
            error_log /var/log/nginx/dgram-2222.log debug;
        }
    }

    3. Start service

  • 相关阅读:
    vue的class绑定
    less里面calc() 语法
    问题
    Spring Boot面试题
    Redis面试题
    nginx面试题
    rabbitMQ面试题
    Linux+Git命令
    docker
    JAVA常用单词
  • 原文地址:https://www.cnblogs.com/oskb/p/8559872.html
Copyright © 2011-2022 走看看