zoukankan      html  css  js  c++  java
  • Nginx负载均衡配置

    >> from zhuhaiqing.info

    [root@localhost nginx]# cat nginx.conf
    user nobody;
    worker_processes 1;

    load_module modules/ngx_http_xslt_filter_module.so;
    load_module modules/ngx_http_perl_module.so;
    load_module modules/ngx_http_js_module.so;
    load_module modules/ngx_stream_js_module.so;
    load_module modules/ngx_http_image_filter_module.so;
    load_module modules/ngx_http_geoip_module.so;

    error_log /var/log/nginx/error.log;
    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;

    server {
      listen 80;
      location / {
        proxy_pass http://agent_server;
        proxy_set_header Host $host:80;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Forwarded-For $remote_addr;
      }
    }

    #负载均衡主机列表
    upstream agent_server {
      server 192.168.10.210:8080 max_fails=3 fail_timeout=4s weight=1;
      ... ...
    }

    sendfile on;
    #tcp_nopush on;
    keepalive_timeout 120;
    #gzip on;
    include /etc/nginx/conf.d/*.conf;
    }

  • 相关阅读:
    opencv学习笔记(五)镜像对称
    opencv学习笔记(四)投影
    C++文件读写详解(ofstream,ifstream,fstream)
    C++ 提取字符串中的数字
    opencv学习笔记(三)基本数据类型
    opencv学习笔记(二)寻找轮廓
    分别心
    关于bonecp和QuerRunner
    关于AutoCommit
    一个detect问题引发的一系列思考
  • 原文地址:https://www.cnblogs.com/zhuhaiqing/p/7758476.html
Copyright © 2011-2022 走看看