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;
        }
    }
相关推荐
00后程序员张1 天前
HTTP抓包工具推荐,Fiddler配置方法、代理设置与使用教程详解(开发者必学网络调试技巧)
网络·http·ios·小程序·fiddler·uni-app·webview
JZZC21 天前
29. HTTP
计算机网络·http·ensp
Chief_fly1 天前
RestTemplate 和 Apache HttpClient 实现 HTTP 请求
网络协议·http·apache
qq_316837751 天前
初步压测的 nginx反向代理 到 Spring Cloud网关 到 Spring Cloud微服务的网络参考配置
nginx·spring cloud·微服务
それども1 天前
HTTP接口和Dubbo接口区别
网络协议·http·dubbo
铭哥的编程日记1 天前
【Linux网络】应用层协议HTTP
linux·运维·http
SakitamaX1 天前
nginx
运维·nginx
Moonbit1 天前
MoonBit Pearls Vol.13: 使用 MoonBit 开发一个 HTTP 文件服务器
服务器·后端·http
一雨方知深秋1 天前
AJAX学习 ---- axios体验
javascript·http·ajax·axios·url·catch·then
24zhgjx-fuhao1 天前
HTTP的配置
网络·网络协议·http