配置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:\nginx-1.9.9

cd C:\nginx-1.9.9

start nginx

最新文章

  1. hdu 3001(状压dp, 3进制)
  2. sencha cmd 更新日志
  3. Xcode-打开代码折叠带
  4. postgresql 触发器
  5. postgresql 分区表创建及测试
  6. 【转】linux root用户ifconfig报command not found
  7. linux c下mysql编程样例
  8. java/python中获取当前系统时间,并与字符串相互转换格式,或者转化成秒数,天数等整数
  9. majikan
  10. [MSDN] GROUP BY (Transact-SQL)
  11. Python pandas 0.19.1 Intro to Data Structures 数据结构介绍 文档翻译
  12. c# 错误 两个输出文件名解析为同一个输出路径
  13. C#事件与委托详解【精华 多看看】
  14. Class_fifth
  15. model browser 不出现时
  16. Keyshot+AD渲染PCB效果图
  17. struct的初始化
  18. 【Unity】2.11 了解游戏有哪些分类对你开阔思路有好处
  19. C语言中二维字符数组的定义和初始化
  20. 2018.10.16 uoj#340. 【清华集训2017】小 Y 和恐怖的奴隶主(矩阵快速幂优化dp)

热门文章

  1. 阿里中间件——diamond
  2. python通过自定义异常,提前退出方法
  3. MES开发学习一
  4. python 2.4 与 python 3.0 的比较
  5. Javascript中DOM的练习
  6. 利用Redis解决Url过长的问题
  7. JSP中的 HttpSession、pageContext对象
  8. install LLVM
  9. H5表单中placeholder属性的字体颜色问题
  10. linux服务器TCP并发连接数优化