我已经为使用 NGINX 的网站设置了多个服务器块。我可以反向代理(以及强制这些网站上的所有流量都使用 https)。我正在尝试设置 MQTT 代理,以便它使用 SSL。
server {
server_name mqtt.example.com;
listen 80;
location /
{
proxy_pass http://172.16.68.67:1884;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mqtt.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mqtt.example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
我可以使用端口 80 连接到我的 mqtt 服务http://www.hivemq.com/demos/websocket-client/但我无法连接到端口 443。这给了我一个通用的“套接字错误”消息。