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;
        }
    }
相关推荐
还是大剑师兰特4 天前
解决nginx错误:http://localhost:7000正常,http://localhost:7000/map 报错404
nginx·大剑师
xing-xing4 天前
Docker容器中Nginx站点根目录网页配置访问
nginx·docker
XUEYUAN52124 天前
ASN 自治系统号风控:平台如何通过 IP 所属自治域批量识别代理流量
python·网络协议·http·网络安全·socks5
PC2005-cloud4 天前
Nginx 防盗链配置实战:用 referer 模块保护网站静态资源
nginx
captain3764 天前
HTTP(2)
java·网络·http·java-ee
PHP实战开发录4 天前
Nginx上传大文件为什么报413
nginx·php·开发
比兔代理5 天前
正向代理与反向代理技术辨析,为什么代理 IP 属于正向代理
服务器·网络·http·ip
Lsetea5 天前
Nginx报No required SSL certificate was sent:mTLS客户端证书排查
运维·nginx·https·ssl·openssl
碳基修炼6 天前
排查记:本地 devServer 是 http,浏览器却把 302 重定向升级成了 https
前端·http
szephyr6 天前
HTTPS 证书申请与自动续期:acme.sh + Let‘s Encrypt 完整记录
nginx·https·acme.sh·证书续期