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;
        }
    }
相关推荐
s_daqing2 小时前
ubuntu(arm)使用nginx安装静态服务器
服务器·nginx·ubuntu
物有本木2 小时前
httpsok-v2.0.8发布-支持IIS证书自动续签
nginx·ssl
Volunteer Technology3 小时前
Nginx部署静态项目
运维·服务器·nginx
摇滚侠4 小时前
尚硅谷 Nginx 教程(亿级流量 Nginx 架构设计),基本使用,笔记 6-42
java·笔记·nginx
衫水5 小时前
Ubuntu 系统部署 Vue/Vite 应用到 Nginx
vue.js·nginx·ubuntu
资料库015 小时前
LVS、Nginx、HAProxy核心区别是什么?
运维·nginx·lvs
亲爱的非洲野猪6 小时前
如何安全关闭 IIS 的 HTTP 端口
网络·安全·http
资深web全栈开发6 小时前
高并发的本质:超越语言的协作哲学——以 Go HTTP 服务器为例
服务器·http·golang·系统设计·goroutine·高并发架构·go并发
掘根1 天前
【jsonRpc项目】常用的零碎功能接口实现
网络协议·http
Filotimo_1 天前
Nginx 的概念
运维·nginx