keepalive+nginx搭建主从负载服务器
keepalive+nginx搭建主从负载服务器
keepalive配置文件 从:
- ! Configuration File for keepalived
- global_defs {
- notification_email {
- xuezm@yaoshi.com
- }
- notification_email_from xuezm@yaoshi.com
- smtp_server mail.yaoshi.com
- smtp_connect_timeout 30
- router_id LVS_DEVEL
- }
- vrrp_instance VI_1 {
- state MASTER
- interface eth0
- virtual_router_id 51
- mcast_src_ip 192.168.11.39
- priority 80
- advert_int 1
- authentication {
- auth_type PASS
- auth_pass chtopnet
- }
- virtual_ipaddress {
- 192.168.11.208
- }
- }
keepalive 主:
- !Configuration File for keepalived
- global_defs {
- notification_email {
- xuezm@yaoshi.com
- }
- notification_email_from xuezm@yaoshi.com
- smtp_server mail.yaoshi.com
- smtp_connect_timeout 30
- router_id LVS_DEVEL
- }
- vrrp_instance VI_1 {
- state MASTER
- interface eth0
- virtual_router_id 51
- mcast_src_ip 192.168.11.27
- priority 100
- advert_int 1
- authentication {
- auth_type PASS
- auth_pass chtopnet
- }
- virtual_ipaddress {
- 192.168.11.208
- }
- }
nginx配置 :
- user nobody nobody;
- worker_processes 1;
- #error_log logs/error.log;
- #error_log logs/error.log notice;
- error_log logs/error.log debug;
- pid logs/nginx.pid;
- events {
- use epoll;
- worker_connections 1024;
- }
- 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 0;
- keepalive_timeout 65;
- gzip on;
- gzip_min_length 1k;
- gzip_buffers 6 16k;
- gzip_http_version 1.1;
- gzip_comp_level 2;
- gzip_types text/plain application/x-javascript text/css application/xml;
- gzip_vary on;
- # location / {
- # root html;
- # index index.html index.htm;
- # }
- error_page 404 /404.html;
- upstream www.test.com {
- server 192.168.11.37:80;
- server 192.168.11.38:80;
- }
- server
- {
- listen 80;
- server_name www.test.com 192.168.11.208;
- index index.htm index.html;
- #root /web/wwwroot;
- location / {
- proxy_pass http://www.test.com;
- proxy_next_upstream http_500 http_502 http_503 error timeout invalid_header;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- include proxy.conf;
- }
- log_format blog_test_com '$remote_addr - $remote_user [$time_local] $request '
- '"$status" $body_bytes_sent "$http_referer" '
- '"$http_user_agent" "$http_x_forwarded_for"';
- access_log logs/blog_test_com;
- }
- }
proxy.conf 配置
- [root@localhost conf]# cat proxy.conf
- proxy_redirect off;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- client_body_buffer_size 128k;
- proxy_connect_timeout 90;
- proxy_send_timeout 90;
- proxy_read_timeout 90;
- proxy_buffer_size 4k;
- proxy_buffers 6 32k;
- proxy_busy_buffers_size 64k;
- proxy_temp_file_write_size 64k;
转载于:https://blog.51cto.com/yijiaxin/844350
keepalive+nginx搭建主从负载服务器相关推荐
- Nginx搭建部署Web服务器并与NFS结合搭建负载均衡服务器
Nginx搭建部署Web服务器并与NFS结合搭建负载均衡服务器 一.搭建NginxWeb服务器 此种方式是用yum安装Nginx,为保证安装成功需在安装之前提前安装epel扩展源. 用 ...
- Nginx搭建flv视频点播服务器
Nginx搭建flv视频点播服务器 前一段时间使用Nginx搭建的多媒体服务器只能在缓冲过的时间区域内拖放, 而不能拖放到未缓冲的地方. 这就带来了一个问题: 如果视频限速的速率很小, 那么客户端观看 ...
- 使用 NGINX 搭建 RTMP 流媒体服务器实现直播功能
使用 NGINX 搭建 RTMP 流媒体服务器实现直播功能 本文介绍了如何使用 Nginx 搭建 RTMP 流媒体服务器,并提供配置文件和前端示例,实现直播功能. 环境 操作系统: Ubuntu 18 ...
- nginx搭建静态文件服务器,利用nginx搭建静态资源服务器的方法步骤
以windows为例,linux其实一样: 搭建静态资源服务器 我电脑上的work文件夹下面有很多图片,我想通过nginx搭建静态资源服务器,通过在地址栏输入ip+port的方式完成目录的映射 找到n ...
- 前后端分离项目nginx搭建静态页面服务器cors做后台跨域接收前台请求
自己在闲暇时间里,无聊的我试着做了一个前后台分离的入门demo.在编写代码前通过查询百度,csdn,博学谷等做了一些准备工作,具体还只是做到前台发送的请求能顺利的发送到后端,时间仓促做的也有不足之处, ...
- nginx+keepalived搭建主从负载均衡并迅速切换
大家都听说过主从服务器或者负载均衡之类的专业术语,作为衡量一个中高级运维工程师的标准,集群和负载是运维工程师必须掌握的技术,然而在一家小公司是根本不会体会到运维的重要性的.首先从理论上讲一下,当用户量 ...
- Linux环境下搭建主从DNS服务器
2017年09月21日 23:33:04 张应明 阅读数 2075 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/zhangym199312/art ...
- 使用Nginx搭建前端静态服务器+文件服务器
大家可能被虚拟主机不太了解,那我们的解释一下,虚拟主机指在一台物理主机服务器上划分出多个磁盘空间,每个磁盘空间都是一个虚拟主机,每台虚拟主机都可以对外提供Web服务,并且互不干扰. 一.Nginx的虚 ...
- Windows基于Nginx搭建RTMP流媒体服务器(附带所有组件下载地址及验证方法)
RTMP服务时常用于直播时提供拉流推流传输数据的一种服务.前段时间由于朋友想搭建一套直播时提供稳定数据传输的服务器,所以就研究了一下如何搭建及使用. 1.下载nginx 首先我们要知道一般nginx不 ...
最新文章
- flask secure_filename 不能识别中文名的解决办法
- CUBRID学习笔记 1 简介 cubrid教程
- mysql err 1118_MySQL ERROR1118报错详解 Row size too large
- 【XSY2720】区间第k小 整体二分 可持久化线段树
- mysql中的生日应该是什么类型_MySQL中的定点数类型
- echarts legend不显示_ECharts地图系列一(定制区域水波纹显示,以及其他区域圆点颜色不统一)...
- Redis中struct运用
- 计算机组成原理—cpu于主存的连接(例题)
- 人脸对齐(九)--SDM算法
- label标签 for属性
- 部署war包到tomcat根目录
- 微会动平台与微云推战略携手赋能企业数字营销推广与业绩增长闭环
- 下载代码的两种方式ssh 和 https
- JAVA计算机毕业设计劳务外包管理系统(附源码、数据库)
- 数据库 ER图、关系模式相互转换 关系代数表达式 查询树,优化查询树 SQL题目
- retinex(SSR,MSR,MSRCR)的优缺点
- 用python绘制叠加等边三角形_python 叠加等边三角形的绘制
- leelen可视对讲怎么接线_电子门铃怎么安装 电子对讲门铃安装方法【详细介绍】...
- 游安军编著的计算机数学答案,计算机数学
- matplotlib——画布分辨率和尺寸
热门文章
- InnoDB 存储引擎详细解析
- python3.7,显卡CUDA版本11.1,安装pytorch-CUDA
- PHP调用jsignature生成图片,App端jSignature签字版生成透明背景png图片
- 使用Linux训练LoRA模型
- 自动控制原理知识点梳理——6.线性系统的校正方法
- Embeded linux之网卡驱动
- form提交--jquery.form.js
- sqlplus set linesize/pagesize等命令详解
- java中getchars是什么意思_java中的getChars()方法
- MySQL(二)锁 ----- 表锁