nginx做负载均衡配置
来源:互联网 发布:unity模型优化 编辑:程序博客网 时间:2024/06/01 08:01
这里只写一下主要配置,至于其他的开启日志,设置权重之类的有兴趣的话可以自行脑补。
以下配置,监听本机的80端口,为www.baidu.com这个域名提供服务。
效果:来自www.baidu.com的请求,平均地转发到 192.16.0.1:80, 127.0.0.1:8080 两个服务上。(nginx.conf)
另外:淘宝tengine的配置和这个基本一样
upstream main {
server 192.16.0.1:80; //此处用于配置tomcat的路径,包括端口,此处也可以进行权重配置
server 127.0.0.1:8080;
}
server {
listen 80; //此处为监听端口,也就是访问时候URL的端口号
server_name www.baidu.com;
server_tokens off;
root /dev/null;
# Increase this if you want to upload larger attachmentsclient_max_body_size 20m;
# individual nginx logs for this vhostaccess_log /var/log/nginx/store_access.log;
error_log /var/log/nginx/store_error.log;
location / {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host teststore.boldseas.com;
#for proxy to IIS proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://main; //此处main和上边upstream main { ....... }中main的名字一样 ,需要注意
proxy_redirect off;
}
}
}
0 0
- nginx做负载均衡配置
- nginx做负载均衡的常用配置
- nginx做负载均衡的配置(简)
- nginx 做均衡负载
- Nginx做负载均衡
- nginx 负载均衡配置
- nginx配置负载均衡
- nginx负载均衡配置
- Nginx负载均衡配置
- Nginx负载均衡配置
- Nginx负载均衡配置
- nginx负载均衡配置
- Nginx 负载均衡配置
- nginx负载均衡配置
- nginx负载均衡配置
- nginx负载均衡配置
- nginx负载均衡配置
- nginx 负载均衡配置
- HDU5170PM2.5
- Android.mk的用法和基础
- 【Cocos2d-x】之随机数的产生
- 利用javabean技术封装对象
- 编写 android.mk 中 LOCAL_C_INCLUDES 的技巧
- nginx做负载均衡配置
- NSSearchPathForDirectoriesInDomains用法
- 非阻塞模式开发
- *LeetCode Search Insert Position -- lower_bound
- Android编译系统参考手册
- 在远程服务器ubuntu14.04上 安装erlang 17.5
- mysql分页原理和高效率的mysql分页查询语句
- Android Studio的Gradle文件方法说明
- android使用动态链接库