LANP+KEEPALIVED集群(二)
LANP+KEEPALIVED集群(二)
#基于不同域名
server
{
listen 80;
server_name nginx.postfix.local;
charset utf-8;
access_log logs/domain.log main;
location /
{
root html/domain;
index domain.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html
{
root html;
}
}
#图示,访问nginx.postfix.local
#基于不同端口
server
{
listen 8080;
server_name 192.168.10.88;
charset utf-8;
access_log logs/port.log main;
location /
{
root html/port;
index port.html;
}
}
#图示,访问192.168.10.88:8080
#nginx.conf配置,基于不同IP、不同域名和不同端口的完整配置
(3)负载均衡配置
#将访问www.postfix.local请求负载到81-84这4台后端服务器
#负载使用ip_hash算法
(4)防盗链配置
#待补充
(5)日志分割配置
#利用信号控制功能来分割日志
#!/bin/sh
#nginx log cut every day
log_path=/home/logs
nginx_log=/usr/local/nginx/logs
mkdir -p $log_path/$(date +%Y)/$(date +%m)
mv $nginx_log/access.log $log_path/$(date +%Y)/$(date +%m)/access.$(date +%Y%m%d).log
mv $nginx_log/error.log $log_path/$(date +%Y)/$(date +%m)/error.$(date +%Y%m%d).log
kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`
#日志分割效果
#设定每天23点开始执行
(6)nginx+ssl
#证书文件存放在/usr/local/nginx/ssl下
#生成1024位rsa密钥server.key
openssl genrsa -des3 -out server.key 1024
#生成server.csr文件
openssl req -new -key server.key -out server.csr
#生成server.crt证书文件
openssl req -new -x509 -days 3650 -key server.key -out server.crt
#配置nginx+ssl
server
{
listen 443 ssl;
ssl on;
server_name www.postfix.local;
ssl_certificate /usr/local/nginx/ssl/server.crt;
ssl_certificate_key /usr/local/nginx/ssl/server.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
access_log logs/443.log;
location / {
root html/443;
index 443.html;
}
}
#图示,nginx.conf配置和访问效果
6、性能优化
(1)源码编译优化
#编译时取消开启debug
#在auto/cc/gcc文件中找到下面的语句,在最前加"#"注释
CFLAGS="$CFLAGS -g"
#对特定CPU类型编译优化
#查看CPU类型
cat /proc/cpuinfo | grep "model name"
#在编译时添加--with-cpu-opt
(2)TCMalloc优化nginx
#TCMalloc在内存分配效率和速度优化,提高服务器在高并发下性能
#安装libunwind-1.1和google-perftools-1.8.2
cd libunwind-1.1
./configure && make && make install
cd google-perftools-1.8.2
./configure && make && make install
echo "/usr/local/lib">/etc/ld.so.conf.d/user_local_lib.conf
#编译时添加选项 --with-google_perftools_module,重新编译nginx
./configure --prefix=/usr/local/nginx --with-pcre --with-http_stub_status_module --with-poll_module --with-http_ssl_module --with-google_perftools_module
make && make install
#在nginx.conf 全局配置添加,以便在nginx启动时加载google-perftools,
google_perftools_profiles /tmp/tcmalloc;
#重启nginx
kill HUP `cat /usr/local/nginx/logs/nginx.pid`
#查看是否已经加载google-perftools
lsof -n | grep tcmalloc
(3)内核优化
#待补充
7、lanp
(1)源码安装nginx
#先安装依赖包
yum -y install pcre-devel zlib-devel openssl-devel
./configure --prefix=/usr/local/nginx --with-pcre --with-http_stub_status_module --with-poll_module --with-http_ssl_module
make && make install
(2)源码安装php和php-fpm
#安装php-5.5.24
#--enable-fpm启用php-fpm,新版本的php已经将php-fpm加入到核心模块
./configure --prefix=/usr/local/php --with-config-file-path=/etc --with-mysql=/usr/local/mysql/ --enable-fpm
make && make install
转载于:https://blog.51cto.com/1055745601/1659218
LANP+KEEPALIVED集群(二)相关推荐
- Keepalived集群快速入门
Keepalived 第 1 章 集群基础 1.1 高可用指标 1.2 关键技术 第 2 章 Keepalived快速入门 2.1 软件基础 2.1.1 keepalived软件结构[记住] 2.1. ...
- kubernetes-1.11.0集群部署之master集群 (二)
kubernetes-1.11.0集群部署之master集群 (二) Master master 的组件有以下: 1. API ServerApi server提供HTTP/HTTPS RESTful ...
- Centos5.5下lvs+keepalived集群
Centos5.5下lvs+keepalived集群<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office: ...
- 纯手工搭建k8s集群-(二)核心模块部署
1. 部署ETCD(主节点) 1.1 简介 kubernetes需要存储很多东西,像它本身的节点信息,组件信息,还有通过kubernetes运行的pod,deployment,service等等.都需 ...
- 华为云Centos7搭建hadoop集群二:yum源替换,ssh免密处理,hadoop用户sudo
华为云Centos7搭建hadoop集群二:yum源替换,ssh免密处理,hadoop用户sudo 新建hadoop用户并设置密码,密码不要设置为简单的123456等,我这里已经创建过了hadoop用 ...
- s20.基于 Kubernetes v1.25 (kubeadm) 和 Docker 部署高可用集群(二)
4.4 安装 Docker master和node安装docker-ce: [root@k8s-master01 ~]# cat install_docker.sh #!/bin/bash # #** ...
- corosync+pacemaker实现高可用(HA)集群(二)
部署方案二(推荐):corosync+pacemaker 利用ansible自动安装corosync和pacemaker 注:关于ansible的具体使用可参见"ansible实现自动化自动 ...
- CentOS 7.5 使用 yum 安装 Kubernetes 集群(二)
一.安装方式介绍 1.yum 安装 目前CentOS官方已经把Kubernetes源放入到自己的默认 extras 仓库里面,使用 yum 安装,好处是简单,坏处也很明显,需要官方更新 yum 源才能 ...
- k8s 手动恢复redis 集群_二进制手动部署k8s-1.14高可用集群(二、集群部署)
1. CA证书(任意节点) 1.1 安装cfssl cfssl是非常好用的CA工具,我们用它来生成证书和秘钥文件 安装过程比较简单,如下: # 下载 $ mkdir -p ~/bin $ wget h ...
- 二进制形式配置k8s集群(二)-生成证书
参考https://github.com/kelseyhightower/kubernetes-the-hard-way/blob/master/docs/04-certificate-authori ...
最新文章
- 小程序将form表单数据写入云数据库
- pcDuino 刷系统-卡刷
- appium安装部署第二季
- idea 亮度 调整_WIN10 困扰多时的屏幕亮度 终于可以调节了-完美 -更新2018年2月28日...
- 《一个操作系统的实现》——pmtest1.asm详解
- golang goroutine的调度模型:MPG模式
- CNN结构:用于检测的CNN结构进化-分离式方法
- C语言实现去掉字符串中指定的字符
- 2021高校暑假时间汇总!最长70天
- mysql 最近5分钟_如何5分钟实现一个最简单的MySQL代理服务器?
- asp.net中后台javaScrip的使用
- java 用mysql游标_MySQL游标
- 小米手机第三方卡刷软件_小米5刷recovery教程及第三方recovery下载
- postgresql修改字段名
- python3 import的一个细节
- An error has occured.See the log file
- Arm NEON intrinsics指令格式
- 计算机图形学——区域填充算法
- 度度熊与邪恶大魔王 (百度之星之资格赛)
- PR-AE-C4D 视频编辑工具的下载地址