铜陵环球家居集散中心:windows 下 Nginx + tomcat 负载均衡配置
来源:百度文库 编辑:九乡新闻网 时间:2024/10/06 17:41:38
windows 下 Nginx + tomcat 负载均衡配置
Nginx 已经是目前公认的效率很高的代理服务,同时可以用来做负载均衡。
由于项目目前只有一台centOS的服务器,无法用来测试,所以打算找下Nginx windows下版本;
http://www.kevinworthington.com/nginx/win32/
以上为win32的版本
用户访问 sp.imichat.com 均衡到 10.10.10.181:8080; 10.10.10.181:8081; 10.10.10.181:8082; 这3台服务器
配置Nginx的nginx.conf
http {}增加如下内容
upstream sp.imichat.com {
server 10.10.10.181:8080;
server 10.10.10.181:8081;
server 10.10.10.181:8082;
}
server {} 修改异侠信息:
listen 80;
server_name sp.imichat.com;
#charset koi8-r;
#access_log logs/host_access_log main;
location / {
proxy_pass http://sp.imichat.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
access_log logs/sp.imichat.com.log combined;
[/code]
启动181上的3个tomcat,修改tomcat首页加入端口信息,以用来清晰看到当前分配到那台tomcat
启动Nginx,访问 http://sp.imichat.com/
可看到请求被发送到3台服务器。
抓http包可看到request为
GET / HTTP/1.1
Host: sp.imichat.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,zh-cn;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: gb2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: JSESSIONID=A75E09D2EBF769A7BD95195E29DE87DE; key=1227008000183; memberName=admin; memberType=%7C%u8D85%u7EA7%u7BA1%u7406%u5458%7C
Pragma: no-cache
Cache-Control: no-cache
response:
HTTP/1.1 200 OK
Server: nginx/0.7.21-win32
Date: Tue, 18 Nov 2008 12:12:33 GMT
Content-Type: text/html
Connection: keep-alive
ETag: W/"8157-1227009260637"
Last-Modified: Tue, 18 Nov 2008 11:54:20 GMT
Content-Length: 8157
Nginx 已经是目前公认的效率很高的代理服务,同时可以用来做负载均衡。
由于项目目前只有一台centOS的服务器,无法用来测试,所以打算找下Nginx windows下版本;
http://www.kevinworthington.com/nginx/win32/
以上为win32的版本
用户访问 sp.imichat.com 均衡到 10.10.10.181:8080; 10.10.10.181:8081; 10.10.10.181:8082; 这3台服务器
配置Nginx的nginx.conf
http {}增加如下内容
upstream sp.imichat.com {
server 10.10.10.181:8080;
server 10.10.10.181:8081;
server 10.10.10.181:8082;
}
server {} 修改异侠信息:
listen 80;
server_name sp.imichat.com;
#charset koi8-r;
#access_log logs/host_access_log main;
location / {
proxy_pass http://sp.imichat.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
access_log logs/sp.imichat.com.log combined;
[/code]
启动181上的3个tomcat,修改tomcat首页加入端口信息,以用来清晰看到当前分配到那台tomcat
启动Nginx,访问 http://sp.imichat.com/
可看到请求被发送到3台服务器。
抓http包可看到request为
GET / HTTP/1.1
Host: sp.imichat.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,zh-cn;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: gb2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: JSESSIONID=A75E09D2EBF769A7BD95195E29DE87DE; key=1227008000183; memberName=admin; memberType=%7C%u8D85%u7EA7%u7BA1%u7406%u5458%7C
Pragma: no-cache
Cache-Control: no-cache
response:
HTTP/1.1 200 OK
Server: nginx/0.7.21-win32
Date: Tue, 18 Nov 2008 12:12:33 GMT
Content-Type: text/html
Connection: keep-alive
ETag: W/"8157-1227009260637"
Last-Modified: Tue, 18 Nov 2008 11:54:20 GMT
Content-Length: 8157
windows 下 Nginx + tomcat 负载均衡配置
Linux 下 nginx 负载均衡配置
nginx 负载均衡配置
Nginx 简单的负载均衡配置示例
Nginx负载均衡基础知识
基于apache的tomcat负载均衡和集群配置
Nginx负载均衡和LVS负载均衡的比较分析
Apache+Tomcat关于Session Sticky的负载均衡
nginx在windows配置虚拟目录的方法
Linux下安装配置Tomcat
Windows中如何配置tomcat+apache
利用虚拟下一跳实现IBGP的负载均衡
tomcat 配置
在Linux下安装nginx,配置及参数
Ubuntu下Nginx的安装及WEB服务配置
lvs负载均衡
memcached集群负载均衡
什么是负载均衡?
Windows 下使用 Nginx Asp.net On IIS
linux下jdk,tomcat安装以及环境变量的配置
Linux环境下Eclipse和Tomcat的安装和配置
nginx防盗链配置
nginx配置conf
Linux下双网卡绑定技术实现负载均衡和失效保护 - 东写西读终见大海无量 - ITeye...