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;
        }
    }
相关推荐
John_Hui13 小时前
CentOS7安装Nginx
linux·服务器·nginx
Lsetea13 小时前
curl下载HTTPS正文是乱码:--compressed与Content-Encoding分层排查
linux·http·https·ssl证书·curl
刘胡子大叔14 小时前
curl resolve 和 Host 头的两种免 DNS 验证 HTTPS
网络协议·http·https
j7~14 小时前
【Linux网络加餐】《HTTP 会话保持:Cookie 与 Session 原理及实验验证》---详解
linux·网络·网络协议·http·cookie·session
mister_guo1 天前
HTTP 和 RPC:从一次干饭说清它们的区别
网络协议·http·rpc
严谨的麻辣烫1 天前
Python HTTP 连接池怎么用?从连接复用到请求异常排查
开发语言·python·http·requests·网络排查
网络小江1 天前
组网第27课:ARP 的能与不能——免费 ARP、代理 ARP 与 ARP 欺骗
服务器·网络·网络安全·负载均衡·免费arp
码林鼠1 天前
flutter网络http请求入门教程-dio
网络协议·flutter·http
Lsetea1 天前
curl访问HTTPS返回304却没有正文:条件请求、缓存与证书验收排查
linux·http·https·ssl证书·curl
honsor2 天前
ModbusTCP、SNMP、HTTP 怎么选?以太网温湿度变送器协议选型实战
网络·物联网·网络协议·tcp/ip·http