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

    配置nginx负载均衡

    执行命令:vi /usr/local/nginx/sbin/nginx/conf/nginx.conf

    修改为:

    worker_processes  2;
    events {
        worker_connections  1024;
    }


    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
    #start
    upstream 192.168.1.208{
    #解决session的问题
    ip_hash;
    server 192.168.1.207:8080 weight=1;
    server 192.168.1.208:8080 weight=1;
    }
    #end
        server {
            listen       80;
            server_name  192.168.1.208;
            location / {
                root   html;
                index  index.html index.htm;
                #请求转向mysvr 定义的服务器列表
       proxy_pass http://192.168.1.208;
       proxy_redirect default;
       #跟代理服务器连接的超时时间,必须留意这个time out时间不能超过75秒,当一台服务器当掉时,过10秒转发到另外一台服务器。
       proxy_connect_timeout 10;
    }
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
        }
    }


    保存退出。
    启动nginx服务,
    访问http://192.168.1.208/应用名称


    nginx的Windows版本,官网下载:http://nginx.org/download/

    个人使用的是:nginx-1.9.9.zip

    解压 nginx-nginx.zip 包到C:根目录,如:C:
    ginx-1.9.9

    cd C: ginx-1.9.9

    start nginx

  • 相关阅读:
    四月⑨日
    4月⑦日
    4月6日
    四月⑧日
    第一天上课
    modelsim的do文件
    SCCB协议
    FPGA之VGA控制
    FPGA常用术语
    乘法器之六(硬件乘法器)
  • 原文地址:https://www.cnblogs.com/xuexin/p/5741329.html
Copyright © 2011-2022 走看看