docker- emqx3.X + nginx configurewss接続

システム:linux(centos7.6)
展開方法:シングルノード展開
docker + nginx + sslバージョン:emqx 3.X(最新の公式イメージを使用)

構成は次のとおりです。

1. dockerデプロイメント(シングルノードデプロイメントであるため、ポート8084をnginxに指定する必要があることに
注意してくださいdocker run -dit --restart always --name emqx -p 1883:1883 -p 8083:8083 -p 8883:8883 -p 8085:8084 -p 18084:18083 emqx / emqx

管理者パスワードの
変更#コンテナを入力して
/ opt / emqx / bin / emqx_ctl admins passwdxiaokaを実行します

#docker exec -it emqx sh -c "/ opt / emqx / bin / emqx_ctl admins passwd admin Passwordadmin "

2.nginx + wssデプロイメント
#/ etc / nginx / conf.d / wss.conf

map $ http_upgrade $ connection_upgrade {
デフォルトのアップグレード;
''閉じる;
}
アップストリームwssweb {
サーバーlocalIP:18083;
}
アップストリームwss {
サーバーlocalIP:8083;
}
サーバー{
リッスン80;
server_name ws.xiaokakj.com;

root html;
index index.html index.htm;

location / {
      proxy_pass http://wssweb;
}

}
サーバー{
リッスン8084ssl ;
server_name ws.test.com;

root html;
index index.html index.htm;
    ssl_certificate   /etc/nginx/cert/a.pem;
    ssl_certificate_key  /etc/nginx/cert/a.key;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

location /mqtt {
      proxy_pass http://wss;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection $connection_upgrade;
     proxy_set_header Host $host;
      proxy_set_header X-Real-Ip $remote_addr;

}

}

おすすめ

転載: blog.51cto.com/15081964/2588553