赞
踩
步骤1:首先安装并启用emqx服务器,此步骤可参照官网文档操作,官网文档
步骤2:配置nginx
- ......
- upstream mqtt_websocket_servers {
- server 192.168.0.2:8083;
- }
-
-
- server {
- listen 8800 ssl;
- server_name baidu.com;
-
- ssl_certificate cert/baidu.com.cer;
- ssl_certificate_key cert/baidu.com.key;
-
- ssl_session_cache shared:SSL:1m;
- ssl_session_timeout 5m;
-
- ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
-
- ssl_protocols TLSv1.2 TLSv1.3;
- ssl_prefer_server_ciphers on;
-
- location / {
- root html;
- index index.html index.htm;
- }
-
-
- location /mqtt {
- proxy_pass http://mqtt_websocket_servers;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "Upgrade";
-
- # 反向代理真实 IP
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header REMOTE-HOST $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-
- # 禁用缓存
- proxy_buffering off;
- }
-
- }
- ......
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。