nginx负载均衡配置
2016-04-06 19:35
411 查看
在虚拟机里边搭建负载均衡 配置主服务器 在c盘里边的 system32/drivers/host进行配置 例如a.com 打开nginx里边的配置文件 vim /etc/nginx/nginx.conf 在http中添加 upstream a.com { server 192.168.5.126:81;从ip server 192.168.5.27:81; } 进入 vim /etc/nginx/conf.d/default.conf server { listen 81; server_name a.com; //主域名 #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; location / { proxy_pass http://a.com; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # root /usr/share/nginx/html; # index index.html index.htm; } } 重启nginx service nginx restart 配置从服务器 server { listen 81; server_name a.com; //主域名 } 重启nginx service nginx restart
相关文章推荐
- Nginx配置一个自签名的SSL证书
- nginx make报错
- LNMP环境搭建之Nginx服务启动失败
- nginx 基本配置
- nginx(二)----ubuntu14.04下启动或重启和关闭nginx
- xhprof&export&source&php运行原理&php+nginx
- (总结)Nginx 502 Bad Gateway错误触发条件与解决方法
- Nginx/Tengine服务启动管理脚本(未使用系统funtions函数)
- 采用软件负载均衡器实现web服务器集群(iis+nginx)
- nginx配置转发详解
- testcookie-nginx-module
- 在Nginx中搭建Nagios监控平台
- Nginx配置文件nginx.conf中文详解
- Windows下nginx+web.py+fastcgi服务搭建
- Nginx Location配置总结
- keepalived+nginx+lvs 实现web群集高可用性
- [ 总结 ] nginx 负载均衡 及 缓存
- Nginx安装与使用
- Nginx负载均衡配置实例详解
- nginx相对于apache的优点