nginx负载均衡之配置和策略
2017-03-22 19:00
417 查看
关于nginx的负载均衡策略,在这里不多说,请见参考文章:
http://blog.csdn.net/xiajun07061225/article/details/9318871
http://blog.csdn.net/xiajun07061225/article/details/9334477
nginx配置参考文章:
http://www.cnblogs.com/oshine/p/3953259.html
http://www.cnblogs.com/jacktang/p/3669115.html
准备工作:三台配置好的服务器(centos7.0 + mysql5.7 + php7.0 + nginx/1.10.3)
配置nginx.cong文件
在http段配置(采用hash策略):
upstream cluster{
server 192.168.2.8:80;
server 192.168.2.23:80;
ip_hash;
}
在server端配置:
重启nginx服务,访问http://localhost/index.php
http://blog.csdn.net/xiajun07061225/article/details/9318871
http://blog.csdn.net/xiajun07061225/article/details/9334477
nginx配置参考文章:
http://www.cnblogs.com/oshine/p/3953259.html
http://www.cnblogs.com/jacktang/p/3669115.html
准备工作:三台配置好的服务器(centos7.0 + mysql5.7 + php7.0 + nginx/1.10.3)
配置nginx.cong文件
[root@localhost conf]# vim /usr/local/nginx/conf/nginx.conf
在http段配置(采用hash策略):
upstream cluster{
server 192.168.2.8:80;
server 192.168.2.23:80;
ip_hash;
}
在server端配置:
server { listen 80; server_name cluster; location / { proxy_pass http://cluster/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }
重启nginx服务,访问http://localhost/index.php
相关文章推荐
- nginx负载均衡的4中配置策略
- nginx负载均衡的4中配置策略
- nginx负载均衡的4中配置策略
- nginx负载均衡的4中配置策略
- nginx负载均衡详细配置
- nginx负载均衡的4中配置策略
- 配置nginx负载均衡时候Nginx服务器导致CSS无法解析不起效果
- Nginx负载均衡的4种方案配置实例
- NGinx负载均衡策略
- Linux系统架构(LB-HA集群)-nginx负载均衡集群配置
- Nginx负载均衡的4种方案配置实例
- nginx负载均衡的配置文件
- nginx负载均衡的配置文件说明
- windows下tomcat和nginx负载均衡的简单配置!
- nginx负载均衡高级策略-upstream
- nginx负载均衡策略知道多少
- nginx负载均衡的4中配置策略
- nginx负载均衡的策略
- 简单测试Apache是如何完成负载均衡策略配置
- Nginx负载均衡的4种方案配置实例