keepalived + nginx(负载均衡反向代理HTTP,https) + tomcat(HTTP,https)
基本架构:
nginx(192.168.116.198)
client --->keepalived(116.200) ------> tomcat (192.168.116.101,192.168.116.100)
nginx(192.168.116.199)
keepalived的配置文件/etc/keepalived/keepalived.conf:
global_defs {
notification_email {
root@node2
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id nginx2
}
vrrp_script chk_nginx {
script "/server/scripts/chk_nginx.sh"
interval 2
fall 2
rise 1
}
vrrp_instance VI_1 {
track_script {
chk_nginx
}
state BACKUP
interface eth0
virtual_router_id 61
priority 90
nopreempt
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.116.200
}
}
###########################
#!/bin/bash
#check service of nginx is ok
/usr/bin/netstat -anlp |grep -w '0.0.0.0:9443' >/dev/null 2>&1
##################################################
前端nginx配置文件:
/etc/nginx/nginx.conf
worker_processes 3;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream shoudian_http{
ip_hash;
server 192.168.116.100:9000;
# server 192.168.116.101:9000;
}
upstream shoudianhttps {
server 192.168.116.100:9443 weight=10;
# server 192.168.116.101:9443 weight=10;
}
server {
listen 9000;
server_name shoudian_http;
location / {
proxy_pass http://shoudian_http;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
server {
listen 9443;
server_name localhost;
ssl on;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
ssl_session_timeout 5m;
location / {
proxy_pass https://shoudianhttps;
}
access_log /etc/nginx/logs/access.log;
error_log /etc/nginx/logs/error.log;
}
}
#后端tomcat的访问方式
curl https://192.168.116.100:9443/
curl http://192.168.116.100:9000/
keepalived + nginx(负载均衡反向代理HTTP,https) + tomcat(HTTP,https)的更多相关文章
- nginx负载均衡(反向代理)
6,安装nginx 6.1 依赖库安装 要安装在root根目录里,不要装在虚拟环境里面 yum install gcc-c++ pcre pcre-devel zlib zlib-devel ope ...
- 架构之Nginx(负载均衡/反向代理)
Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器 ,也是一个 IMAP/POP3/SMTP 代理 服务器 . Nginx 是由 Igor Sys ...
- nginx 负载均衡 反向代理
nginx 通过方向代理实现负载均衡,负载均衡是大流量网站要做的措施,单从字面上的意思来理解为N台服务器平均分担负载,不会因为某一台服务器负载高宕机而影响用户访问网站,负载均衡至少需要三台服务器, 既 ...
- Nginx负载均衡反向代理 后端Nginx获取客户端真实IP
Nginx 反向代理后,后端Nginx服务器无法正常获取客户端的真实IP nginx通过http_realip_module模块来实现的这需要重新编译,如果提前编译好了就无需重新编译了1,重新编译ng ...
- Nginx负载均衡反向代理
http{ upstream test.com { server 118.118.66.88:8080; } server { listen 80; server_name www.test.com; ...
- Nginx服务器部署 负载均衡 反向代理
Nginx服务器部署负载均衡反向代理 LVS Nginx HAProxy的优缺点 三种负载均衡器的优缺点说明如下: LVS的优点: 1.抗负载能力强.工作在第4层仅作分发之用,没有流量的产生,这个特点 ...
- Nginx HTTP负载均衡/反向代理的相关参数测试
原文地址:http://www.cnblogs.com/xiaochaohuashengmi/archive/2011/03/15/1984976.html 测试目的 (1)弄清楚HTTP Upstr ...
- nginx域名转发 负载均衡 反向代理
公司有三台机器在机房,因为IP不够用,肯定要分出来,所以要建立单IP 多域名的反向代理, 就是当请求www.abc.com 跳转到本机, 请求www.bbc.com 跳转到192.168.0.35 机 ...
- nginx做为web容器部署静态资源以及做负载均衡反向代理实现
需求: 此时前台开发完成打包生成静态资源文件,要做到以下方面: 使用nginx部署静态资源,同时nginx要实现端口转发,隐藏真实后台地址,同时后台需要做一个负载均衡. localhost:7001 ...
随机推荐
- Unity3D 场景切换加载进度条实现
需要三个场景,场景A,场景B,场景C: 场景A:一个按钮,点击加载场景B: 场景B:从A切换到C过度场景,加载进度条: 场景C:目标场景: 创建OnProgress.cs脚本: using Syste ...
- curl 封装类
<?php /** * author: zbseoag * QQ: 617937424 用法: $content = Curl::instance()->url($url)->get ...
- bootstrap前端框架使用总结分享
1.bootstrap 排版 全局样式style.css: 1.移除body的margin声明 2.设置body的背景色为白色 3.为排版设置了基本的字体.字号和行高 4.设置全局链接颜色,且当链接处 ...
- Spring Boot—07应用application.properties中的配置
方法1 @Value("${test.msg}") private String msg; 方法2 @Autowired private Environment env; Stri ...
- WPF ListView 使用GridView 带有Header 以及点击header排序 sort
ListView: <ListView x:Name="lvFiles" VerticalAlignment="Stretch" Background=& ...
- 【Android】Retrofit网络请求Service,@Path、@Query、@QueryMap...
对Retrofit已经使用了一点时间了,是时候归纳一下各种网络请求的service了. 下面分为GET.POST.DELETE还有PUT的请求,说明@Path.@Query.@QueryMap.@Bo ...
- asp:FileUpload 上次图片
<asp:FileUpload ID="FileUpload附件" runat="server" Width="200px" /> ...
- 让Oracle的 SHOW PARAMETER 命令显示隐藏参数
转自 http://blog.csdn.net/staricqxyz/article/details/8624549 Find internal of "show parameter&quo ...
- MVC 在视图中获取当前的Controller、Action的方式
在视图中获取Controller和Action的方式: Controller: @ViewContext.RouteData.Route.GetRouteData(this.Context).Valu ...
- Azure Cosmos DB 使用费用参考
之前在学习Cosmos DB 中SQL API(DocumentDB) 的时候,也就是之前做的一些笔记,看到有使用费用的一些介绍,就有兴趣的去了解了下,做了一下简单的总结. 想了解更多或是购买使用的还 ...