nginx配置http负载均衡转发

在http内新增如下代码

复制代码
//要被转发到的地址
upstream mqttservice{
        server ip1:18083 weight=1;
        server ip2:18083 weight=1;
        server ip3:18083 weight=1;
    }

    server {
        listen       9816;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://mqttservice;
        }
    }
相关推荐
peihexian7 分钟前
ingress-nginx更换为f5 nginx gateway fabric
nginx·gateway·fabric
一颗青果6 小时前
HTTP协议详解
linux·网络·网络协议·http
Joy T9 小时前
【AI运维】02 云上基础部署:ECS、OSS 与 Nginx 的体系化理解与实践
运维·nginx
Dreamboat-L9 小时前
云服务器上部署nginx
java·服务器·nginx
季__末12 小时前
WSL2安装配置
nginx
nn在炼金15 小时前
大模型领域负载均衡技术
人工智能·算法·负载均衡
talenteddriver18 小时前
Java Web:http请求在springboot项目中的传递层级(自用笔记)
java·前端·spring boot·http
登山人在路上20 小时前
Nginx负载均衡策略
服务器·nginx·负载均衡
bkspiderx20 小时前
HTTP跨域问题深度解析:4种实用解决方案与场景适配
网络·http·nginx反向代理·cors·跨域资源共享·http跨域问题
雪域迷影20 小时前
使用Python库获取网页时报HTTP 403错误(禁止访问)的解决办法
开发语言·python·http·beautifulsoup·urllib