windows 下设置nginx负载均衡
#user nobody;
worker_processes ; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections ;
} http {
include 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 logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout ;
keepalive_timeout ; #gzip on; upstream mysvr {
#weigth参数表示权值,权值越高被分配到的几率越大
#.down 表示单前的server暂时不参与负载
#.weight 默认为1.weight越大,负载的权重就越大。
#.backup: 其它所有的非backup机器down或者忙的时候,请求backup机器。所以这台机器压力会最轻。
#server 192.168.1.116 down;
#server 192.168.1.116 backup;
server 192.168.1.128: weight=;
server 192.168.1.194: weight=;
} server {
listen ; #这里是外网公布的访问的端口
server_name 122.122.122.122; #这里是外网公布的访问的公网ip 、或是域名 #charset koi8-r; #access_log logs/host.access.log main; location / {
proxy_pass http://mysvr; #跟载均衡服务器的upstream对应 proxy_connect_timeout 5s; #这里代表其中一台服务器宕机之后把访问转向另外一台服务器
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#禁用缓存
proxy_buffering off;
} #error_page /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen ;
# listen somename:;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#} }
nginx相关命令:
1) 启动Nginx:start nginx
2) 停止Nginx:nginx -s stop
3) 修改配置后重启:nginx -s reload
windows 下设置nginx负载均衡的更多相关文章
- windows下搭建nginx负载均衡
学习笔记,第一次记录避免忘记 首先介绍一下本地环境是windows2008 R2-64位. 1. 到nginx官网上下载最新稳定版的安装包,http://nginx.org/en/download. ...
- Windows下apache+tomcat负载均衡
Windows下apache+tomcat负载均衡 网上已经有很多的资料,但是很多都比较零碎,需要整合一起才能搭建出理想的负载均衡,正好前段时间搭建了windows与linux下的负载均衡,在此记录, ...
- Mac下配置Nginx负载均衡
1.首先在Mac下安装Nginx(可参考我的另一篇随笔http://www.cnblogs.com/malcolmfeng/p/6896703.html). 2.安装Tomcat,下载后,解压,bin ...
- linux下配置nginx负载均衡例子
准备2台虚拟机: 分别在两个虚拟机上安装tomcat,并在服务器A安装nginx,其中nginx端口设置为了 70. 服务器A的tomcat安装目录: 服务器B的tomcat安装目录: 服务器A的ng ...
- Nginx负载均衡搭建(Window与Linux)
windows上搭建nginx负载均衡 1.准备几台http服务器软件,这里选用一台apache一台tomcat apache(windows)下载链接:https://www.apachehaus. ...
- NGINX 负载均衡的理解
前言 NGINX是轻量级,也是当前比较流行的web服务器软件.体积小但是功能强大. 这里我按照自己的理解,记录下对NGINX负载均衡的认识.(加权均衡,最小连接) 这里参考了 [https://blo ...
- Nginx负载均衡策略的介绍与调优
工作中经常会用到nginx负载均衡这一块,下面对nginx负载均衡策略做个总结.本人在工作中最常用到的负载均衡策略是轮询策略. 在一般情况下,Web中间件最大的作用就是负责对请求进行分发,也就是我们常 ...
- Windows下使用Nginx+Tomact做负载均衡
前言 今天,王子与大家闲谈一下如何在Windows下使用Nginx+Tomcat做负载均衡的完整步骤,小伙伴们可以试着自己动手实践一下哦. 另外说明一点,本篇文章是纯实操文章,不涉及太多原理的解读,后 ...
- Windows实战(1):Nginx代理设置及负载均衡配置
简言 以下配置实现功能: 反向代理 通过轮询的方式实现nginx负载均衡 直接看以下配置文件: #user nobody; worker_processes 1; #error_log logs/er ...
随机推荐
- mongodb 副本集部署
1.安装三节点linux环境:196.168.1.111,196.168.1.112,192.168.1.113(三节点可彼此ping通) 2.三节点安装mongodb,参考https://blog. ...
- 检查WMI协议是否通的
在APM上的运行执行“wbemtest”,然后在上面的root\sivm前面加RPC不通的机器,先查WMI协议是否是通的
- 使用solr界面管理工具创建core 不能用的解决方法
可以用命令行进行创建 首先要先进入 solr所属的 用户 solr 中 ./solr create -c solr_sample 然后创建 你的core 显示以下信息 就创建成功了 成功之之后可以 ...
- 每月IT摘录201901
技术 1.Jsessionid只是tomcat的对sessionid的叫法,其实就是sessionid:在其它的容器也许就不叫jsessionid了. 2.在 InnoDB 中,索引使用的数据结构是 ...
- stm32架构初认识
刚接触stm32f373c8t6的芯片,这到底是怎末开发的,应该说它是SOC,内部有一个核心芯片,然后在芯片的外部添加了一些有特殊功能的外设,使开发者能够完成想要的功能,以stm32f373c 8t6 ...
- [剑指Offer]23-链表中环的入口节点
题目链接 https://www.nowcoder.com/practice/253d2c59ec3e4bc68da16833f79a38e4?tpId=13&tqId=11208&t ...
- for all entries
1.必须要判断for all entries in后面的内表是否为空,如果为空,where条件中与内表中字段进行比较的结果全部为真,会导致取出非常多的数据,影响系统性能.2.使用for all ent ...
- linux详解sudoers
sudo使用 Linux是多用户多任务的操作系统, 共享该系统的用户往往不只一个.出于安全性考虑, 有必要通过useradd创建一些非root用户, 只让它们拥有不完全的权限; 如有必要,再来提升权限 ...
- springmvc中的拦截器interceptor用法
1.配置拦截器 在springMVC.xml配置文件增加: 1 <mvc:interceptors> 2 <!-- 日志拦截器 --> 3 <mvc:intercepto ...
- opencv版本的问题
opencv版本的问题(由于我安装了两个版本opencv-2.4.9 and opencv-3.1.0),搜了相关问题,可以通过修改了CMakeList.txt解决此问题. 参考了这个博客:http: ...