配置看了好久没啥问题啊,跟着网上的帖子做的,各位大佬帮忙看看吧,求求了
4条回答 默认 最新
- liyanjing1210 2020-03-25 11:42关注
服务器集群名称,采用负载策略是轮询权重
upstream balance.com {
server 172.16.100.7:8001 weight=1 max_fails=3 fail_timeout=30s;
server 172.16.100.8:8001 weight=2 max_fails=3 fail_timeout=30s down;
}
server {
listen 80;
server_name 127.0.0.1;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
#将请求转向 balance.com 定义的服务器列表
proxy_pass http://balance.com;#允许重新定义或添加字段传递给代理服务器的请求头,请阅读proxy_set_header #端口号是容器对应的宿主机的port proxy_set_header Host $host:80; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Via "nginx"; proxy_set_header Cookie $http_cookie; proxy_redirect off; #expires 1d; }
}
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 stm32开发clion时遇到的编译问题
- ¥15 lna设计 源简并电感型共源放大器
- ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
- ¥15 Vue3地图和异步函数使用
- ¥15 C++ yoloV5改写遇到的问题
- ¥20 win11修改中文用户名路径
- ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
- ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
- ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
- ¥15 帮我写一个c++工程