1.下载Windows版本的Nginx

http://nginx.org/en/download.html

2.解压Nginx包,配置conf文件下的nginx.conf文件

3.配置说明:

#user  nobody;
#N工作进程数,默认为1
worker_processes ; #错误日志保存路径
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid文件路径
#pid logs/nginx.pid; #工作模式及连接数上限
events {
#单个后台worker process进程的最大并发链接数,默认1024,可以按照最大客户端连接数max_clients配置
#nginx作为http服务器的时候:
#max_clients = worker_processes * worker_connections #nginx作为反向代理服务器的时候:
#max_clients = worker_processes * worker_connections/
worker_connections ;
} #http服务器配置,做web服务器或反向代理
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;#开启高效传输模式 #在nginx中,tcp_nopush配置与tcp_nodelay“互斥”。它可以配置一次发送数据包的大小。
#也就是说,数据包累积到一定大小后就发送。
#在nginx中tcp_nopush必须和sendfile配合使用。
#tcp_nopush on; #连接超时时间 单位是秒
#keepalive_timeout ;
keepalive_timeout ; #启用gzip压缩
#gzip on; upstream web70{ #有域名的可以用域名
#负载的一个实例,可以是外网IP
#默认轮询,把每个请求按顺序逐一分配到不同的server,如果server挂掉,能自动剔除。 #其他配置:
#.在负载的实例后面加weigth参数,表示权值,权值越高被分配到的几率越大
#譬如server 127.0.0.1: weight=; #.把请求分配到连接数最少的server
#least_conn; #.每个请求会按照访问ip的hash值分配,这样同一客户端连续的Web请求都会被分发到同一server进行处理
#可以解决session的问题。如果server挂掉,能自动剔除。
#ip_hash; server 127.0.0.1:; #weight=;
server 127.0.0.1:; #weight=;
} #对外web服务器实例
server {
listen ;#监听端口
server_name localhost;#服务器名,默认localhost #默认字符编码,默认koi8-r,可改为utf-
#charset koi8-r;
charset utf-; #本服务器实例日志路径
#access_log logs/host.access.log main; #默认请求配置
location / {
root html;#web服务器根目录,用来放网站程序的目录
index index.html index.htm;#默认首页
proxy_pass http://web70; #请求转向的url地址,反向代理则填写对应upstream后面的域名
proxy_redirect default;
} #错误页面
#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;
# }
#} }

4.打开控制台进入Nginx目录,输入nginx.exe命令来启动Nginx

5.打开任务管理器可以看到Nginx已经在运行了,此时控制台也可以关闭了

6.配置负载均衡web实例

7.然后刷新Nginx的服务器,显示第一个负载的web实例

8.再刷新下,显示第二个负载的web实例

Nginx其他命令:

nginx.exe -s stop     //停止nginx
nginx.exe -s reload //重新加载nginx
nginx.exe -s quit //退出nginx

Nginx配置文件下下载

Windows下安装Nginx及负载均衡的更多相关文章

  1. Windows下搭建Nginx实现负载均衡

    环境:本次测试,使用两台电脑,分别是 192.168.0.1,192.168.0.2. 其中Nginx也部署在 192.168.0.1 电脑上,所以 PC1 的IIS端口不能使用80,因为Nginx需 ...

  2. 【高可用HA】Nginx (1) —— Mac下配置Nginx Http负载均衡(Load Balancer)之101实例

    [高可用HA]Nginx (1) -- Mac下配置Nginx Http负载均衡(Load Balancer)之101实例 nginx版本: nginx-1.9.8 参考来源: nginx.org [ ...

  3. Linux下利用nginx实现负载均衡

    linux下利用nginx实现负载均衡 前提条件: 1,安装好jdk 2,安装好tomcat和nginx(可以参考我前两篇文章) 满足前提条件后,要用nginx实现负载均衡,主要是靠配置nginx的配 ...

  4. windows下安装nginx

    说起开发,自己感到非常惭愧,由于公司让我给<绿电侠>项目写整体架构解决方案,才开始接触nginx这个东东,突然觉得它是一把非常好的利器. 本文主要记录在windows下安装nginx,另参 ...

  5. [转]CENTOS 6.5 配置YUM安装NGINX+服务器负载均衡

    原文连接: CENTOS 6.5 配置YUM安装NGINX  http://blog.sina.com.cn/s/blog_69f467b70102uyux.html 参考博文: Centos下安装. ...

  6. Nginx简单介绍以及linux下使用Nginx进行负载均衡的搭建

    1.Nginx简介 Nginx是一款高性能的http 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器.由俄罗斯的程序设计师Igor Sysoev所开发,官方测试nginx能够支支撑5 ...

  7. Docker安装nginx以及负载均衡

    首先在linux系统中新建一个data文件夹进行nginx容器的创建--即为:mkdir data. 一:第一次 1 第一步: 使用 docker pull nginx将nginx的镜像从仓库下载下来 ...

  8. windows下tomcat7+nginx1.8负载均衡

    1.负载平衡是一种常用的跨多个应用程序实例 技术优化资源利用率,最大化吞吐量, 减少延迟,并确保容错配置. 2.使用nginx作为非常有效的HTTP负载均衡器 将流量分发给几个应用程序服务器和改善 性 ...

  9. Nginx 在windows下配合iis搭建负载均衡过程 [转]

    因为项目遇到大量图片存储问题,虽然现在我们图片还不是很多(目前在1T上下,预计增长速度每年1.3倍的增长速度),自己在思考如何有效地存储大量图片时,查找一些资料,看到了,有人使用 Nginx搭建服务器 ...

随机推荐

  1. 笔记:Windows Server2008R2服务安装

    Windows Server2008R2 服务安装 服务一:IIS,internet information services,互联网信息服务,微软开发的运行在Windows系统中互联网服务,提供了w ...

  2. linux线程控制-2(线程控制函数)

    记录肖堃老师讲解的linux线程 1. 创建线程 int pthread_create( (pthread_t *thread, pthread_attr_t *attr, void *(*start ...

  3. HDFS概述和Shell操作

    大数据技术之Hadoop(HDFS) 第一章 HDFS概述 HDFS组成架构 HDFS文件块大小 第二章 HDFS的Shell操作(开发重点) 1.基本语法 bin/hadoop fs 具体命令    ...

  4. latex:公式的序号

    1.排序单位 在文类book或report中,行间公式是以章为排序单位的,即每一新章节开始,公式序号计数器equation就被清零.比如第1章第3个公式的序号是(1.3),第2章第1个公式的序号是(2 ...

  5. 如何使用SPSSAU计算耦合协调度?

    什么是耦合协调度模型 耦合协调度模型用于分析事物的协调发展水平.耦合度指两个或两个以上系统之间的相互作用影响,实现协调发展的动态关联关系,可以反映系统之间的相互依赖相互制约程度.协调度指耦合相互作用关 ...

  6. Flink启动脚本改造--制作适用于CDH的Flink parcel包

    #!/usr/bin/env bash ################################################################################ ...

  7. CF1349A Orac and LCM 题解

    题意分析 给出$n$个数,求这$n$个数两两的最小公倍数的最大公约数 思路分析 通过分析样例可以发现,如果要成为这$n$个数两两的最小公倍数的公约数,至少要是这$n$个数中$n-1$个数的约数,否则就 ...

  8. 力扣Leetcode 1518. 换酒问题

    小区便利店正在促销,用 numExchange 个空酒瓶可以兑换一瓶新酒.你购入了 numBottles 瓶酒. 如果喝掉了酒瓶中的酒,那么酒瓶就会变成空的. 请你计算 最多 能喝到多少瓶酒. 示例: ...

  9. Illegal instruction报错 c/c++

    报错 # ./agent Illegal instruction# 原因 myLog(log4cplus::INFO_LOG_LEVEL, g_p_debugLog, "sendLog ip ...

  10. 新手oracle重启、监听

    有一次遇到了记录下. #su到oracle用户下 [root@localhost ~]# su - oracle  #重启数据库:[oracle@localhost ~]$ sqlplus /nolo ...