nginx反向代理三台web服务器,实现负载均衡
来源:互联网 发布:centos lnmp安装包 编辑:程序博客网 时间:2024/05/14 20:10
步骤:
1 [root@localhost ~]# vim /usr/local/nginx-1.12.0/conf/nginx.conf[root@localhost ~]# cp /usr/local/nginx-1.12.0/conf/nginx.conf /usr/local/nginx-1.12.0/conf/nginx1.conf[root@localhost ~]# vim /usr/local/nginx-1.12.0/conf/nginx1.conf[root@localhost ~]# vim /usr/local/nginx-1.12.0/html/index.html[root@localhost ~]# cd /usr/local/nginx-1.12.0/sbin/[root@localhost sbin]# /usr/local/nginx-1.12.0/sbin/nginx -c /usr/local/nginx-1.12.0/conf/nginx.conf[root@localhost sbin]# /usr/local/nginx-1.12.0/sbin/nginx -c /usr/local/nginx-1.12.0/conf/nginx1.conf
修改nginx.conf
upstream songwei{ server 192.168.16.39:8080; server 192.168.16.110:8080;#在http和server之间加入这个模块 server 192.168.16.121:8080; }##后面的serever也得改
nginx.conf的server
server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://songwei; # root html; #index index.html index.htm; }
修改nginx1.conf(第一个从机)因为我主机作为代理服务器和从机1,所以这样设置
server { listen 8080; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; }
修改nginx.conf(第二个从机)
server { listen 8080;#只修改这里 server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; }
同理修改第三个从机的nginx.conf
修改index.html
然后重启就ok
阅读全文
0 0
- nginx反向代理三台web服务器,实现负载均衡
- linux 负载均衡 nginx反向代理 tomcat web服务器
- Nginx反向代理实现Tomcat集群服务器的负载均衡
- Nginx反向代理实现Tomcat集群服务器的负载均衡
- swoole模拟多服务器Nginx反向代理实现负载均衡
- Nginx实现反向代理和负载均衡
- nginx反向代理实现http负载均衡
- 使用Nginx反向代理实现负载均衡
- nginx做反向代理实现负载均衡
- nginx反向代理tomcat实现负载均衡
- Nginx反向代理实现负载均衡总结
- Nginx反向代理实现均衡负载
- Nginx反向代理实现均衡负载
- Nginx实现负载均衡和反向代理
- Nginx实现负载均衡的反向代理
- Nginx实现反向代理负载均衡
- nginx实现反向代理和负载均衡
- nginx 实现反向代理和负载均衡
- framebuffer驱动详解3——framebuffer驱动框架分析
- jstl 格式化日期
- VTK生成球并将其导出为obj三维格式,可在Meshlab中提取三维点云
- java并发编程(三)--java中的锁(Lock接口和队列同步器AQS)
- QString的常用方法
- nginx反向代理三台web服务器,实现负载均衡
- 使用 GPUs
- Mac开发学习笔记之label使用超链接
- LVM---Linux
- linux 信号signal和sigaction理解
- Layout新姿势—ConstraintLayout
- 查看Linux系统当前时间的命令
- jquery操作select(取值,设置选中
- 十分钟理解Java中的动态代理