当前位置: 首页 > wzjs >正文

网站建设图片上传图片转链接生成器在线制作

网站建设图片上传,图片转链接生成器在线制作,wordpress如何做seo,有没有catia做幕墙的网站本文介绍了nginx反向代理多虚拟主机节点服务器配合keepalived实现高可用和负载均衡,keepalived除了能够管理LVS软件外,还可以作为其他服务的高可用解决方案软件。采用 nginxkeepalived,它是一个高性能的服务器高可用或者热备解决方案&#xf…

本文介绍了nginx反向代理多虚拟主机节点服务器配合keepalived实现高可用和负载均衡,keepalived除了能够管理LVS软件外,还可以作为其他服务的高可用解决方案软件。采用 nginx+keepalived,它是一个高性能的服务器高可用或者热备解决方案,Keepalived主要来防止服务器 单点故障的发生问题,可以通过其与Nginx的配合实现Web服务器端的高可用。使用keepalived可以保 证nginx的高可用,他能监控nginx的健康状态,当nginx出现宕机时自动主备切换

配置有点像:基于keepalived实现haproxy高可用站点-CSDN博客

环境准备:

4台Linux Rocky8.10虚拟机,两台提供nginx的web服务器:192.168.118.131/129。本项目采用非keepalived的非抢占模式,两台keepalived的互为backup服务器:192.168.118.128/130

配置nginx服务器

下载:

yum install nginx -y

配置:vim /etc/nginx/conf.d/vhost.conf

server {listen 80;server_name bbs.test.com;location /{root /usr/share/nginx/html/bbs;index index.html index.htm;}access_log /usr/share/nginx/html/bbs/logs/access_bbs.log main;
}server {listen 80;server_name www.test.com;location /{root /usr/share/nginx/html/www;index index.html index.htm;}access_log /usr/share/nginx/html/www/logs/access_www.log main;
}

 关闭selinux和防火墙:setenforce 0 && systemctl stop firewalld

在两台服务器上面执行以下命令:

mkdir -p /usr/share/nginx/html/{www,bbs}
touch /usr/share/nginx/html/www/index.html
touch /usr/share/nginx/html/bbs/index.html
echo "bbs: This is a test page which from: IP:$(hostname -I)" > /usr/share/nginx/html/bbs/index.html
echo "www: This is a test page which from: IP:$(hostname -I)" > /usr/share/nginx/html/www/index.htmltouch  /usr/share/nginx/html/bbs/logs/access_bbs.log
touch  /usr/share/nginx/html/www/logs/access_www.log
chown -R nginx:nginx /usr/share/nginx/

 拓扑结构:

[root@localhost ~]# tree /usr/share/nginx/html/
/usr/share/nginx/html/
├── 404.html
├── 50x.html
├── bbs
│   ├── index.html
│   └── logs
│       └── access_bbs.log
├── index.html
├── nginx-logo.png
├── poweredby.png
└── www
    ├── index.html
    └── logs
        └── access_www.log

 启动nginx:systemctl start nginx

测试

echo "192.168.118.129  www.test.com  bbs.test.com" >> /etc/hosts

 [root@localhost conf.d]# curl www.test.com
www: This is a test page which from 192.168.118.129
[root@localhost conf.d]# curl bbs.test.com
bbs: This is a test page which from 192.168.118.129

配置nginx代理

vim /etc/nginx/conf.d/vtest.conf

upstream server_pools {server 192.168.118.129:80 weight=1;                                                   server 192.168.118.131:80 weight=1;
}                                                                                                                                                                           server {                                                                                      listen  80;                                                                           server_name www.test.com;location / {proxy_pass http://server_pools;                                                             #传递原始的host头部信息proxy_set_header Host $host;}
}                                                                                                                                                                           server {listen  80;                                                                           server_name bbs.test.com;location / {proxy_pass http://server_pools;#传递原始的host头部信息proxy_set_header Host $host;}
}

 在这段配置中,当请求的server_name匹配到bbs.test.com或者www.test.com时,location /会捕获所有对www.test.com或者bbs.test.com的请求,无论请求的URL是什么。这些请求都会被转发到上游服务器池server_pools中

 然后在/etc/hosts中写入域名

#130主机
[root@localhost conf.d]# tail -1 /etc/hosts
192.168.118.130 www.test.com bbs.test.com
#128主机
[root@localhost conf.d]# tail -1 /etc/hosts
192.168.118.128 www.test.com bbs.test.com

测试

[root@localhost ~]# for ((i=1;i<=4;i++));do curl www.test.com;done
www: This is a test page which from 192.168.118.129
www: This is a test page which from 192.168.118.131
www: This is a test page which from 192.168.118.129
www: This is a test page which from 192.168.118.131
[root@localhost ~]# for ((i=1;i<=4;i++));do curl bbs.test.com;done
bbs: This is a test page which from 192.168.118.129
bbs: This is a test page which from 192.168.118.131
bbs: This is a test page which from 192.168.118.129
bbs: This is a test page which from 192.168.118.131

 配置keepalived

vim /etc/keepalived/keepalived.conf

! Configuration File for keepalived
global_defs {router_id LVS_1
}
vrrp_script chk_nginx {script "killall -0 nginx"#检查是否开启了nginx代理
}vrrp_instance VI_1 {state BACKUP#备份模式interface ens160mcast_src_ip 192.168.118.130#基于这个源IP的健康检查nopreempt#非抢占模式virtual_router_id 51priority 100#优先级advert_int 1#间隔时间authentication {#认证auth_type PASSauth_pass 1111}track_script {#调用脚本chk_nginx
}virtual_ipaddress {#VIP192.168.118.110}
}

 systemctl start keepalived

效果

 单开两个进程去时刻检查日志:tail -f /var/log/messages

当拥有VIP的一方停止nginx服务时,立刻就会移除VIP,另一方获得VIP

 当其恢复时,VIP也不会回到自己这台主机上面,减少主从交换频率,提高稳定性。这就是非抢占模式

 最后测试是否依旧可以通过这个虚拟IP访问:curl -H表示携带head信息

以上访问被分流,且更具访问的URL到不同页面


文章转载自:

http://sN289VpB.xsncf.cn
http://GAeMqm41.xsncf.cn
http://Y0c92G9l.xsncf.cn
http://z6NTnKGF.xsncf.cn
http://vHZ28z19.xsncf.cn
http://cAKhxaAO.xsncf.cn
http://QSJ0K0pA.xsncf.cn
http://HQVqeAzU.xsncf.cn
http://99mW0CYl.xsncf.cn
http://5Wu90NvP.xsncf.cn
http://efu4kDdE.xsncf.cn
http://0mqxQs7w.xsncf.cn
http://SXFmga52.xsncf.cn
http://m4JGVEyv.xsncf.cn
http://1CCLKkTZ.xsncf.cn
http://pqYYOw7O.xsncf.cn
http://3mNzYgDC.xsncf.cn
http://D3idFYPF.xsncf.cn
http://Ffr9pFYI.xsncf.cn
http://JadzIPUf.xsncf.cn
http://DacnhL98.xsncf.cn
http://sSrES000.xsncf.cn
http://yAb77bw7.xsncf.cn
http://aE1leceN.xsncf.cn
http://La5kTusR.xsncf.cn
http://Q9GQ5n6V.xsncf.cn
http://1lh7oUSp.xsncf.cn
http://J1EjVWwh.xsncf.cn
http://Vq64je66.xsncf.cn
http://f4LGWzle.xsncf.cn
http://www.dtcms.com/wzjs/764973.html

相关文章:

  • 网站备案去哪找接入商360算互联网大厂吗
  • 华北建设集团有限公司oa网站厦门建行网站首页
  • 开发一整个网站要多久淘宝网站建设的主要工作
  • 什么是域名访问网站宁波网站推广公司
  • 云南网站建设招商做英文网站怎么赚钱
  • app推广平台网站始兴县建设局网站
  • 太原做网站联系方式scratch少儿编程网站
  • 入门做网站wordpress foot增加js
  • 杭州网站建设页面share poine 户做网站
  • 郑州做网站公司 汉狮网络做视频网站 视频放在哪里
  • 黄岩区信誉好高端网站设计个人网站备案名和运营
  • 网站开发员的工作内容商务网站建设的步骤
  • 肥城网站建设公司什么网站可以做宝宝相册
  • 企业自建站环保业网站建设的策划
  • 广西网站建设的公司临沂 网站推广
  • 如何开一个自己的网站微信公众号登录入口怎么找
  • 建筑工程网图清远市seo网站设计联系方式
  • 免费的微网站哪个好正规的培训行业网站开发
  • 网站优化三要素申请企业邮箱步骤是什么?
  • 优秀的展厅设计网站wordpress阿里云图片不显示不出来
  • 武威建设厅网站有哪些做的好的自学网站
  • 阿里网站域名要购卖吗建设和交通局网站
  • 河北怀来县建设局网站网站备案需要提供网站建设方案书
  • 网站的功能需求聊城建设学校毕业证
  • 做竞拍网站合法吗深圳网站建设哪家
  • 怀柔石家庄网站建设自己如何做企业网站
  • 网站涉及敏感视频等该怎么做logo和网站主色调
  • 米东区成业建设集团公司网站网站开发外文翻译
  • 永年做网站多少钱dz论坛做视频网站教程
  • 网站建设框架构建个人微信公众平台怎么用