目录

关注我们

关注 ThingsBoard 微信公众号

手动增加微信公众号:thingsboard_cn
2023-10-26T01:09:12.png

访问 ThingsBoard 中文社区网站

访问网址:http://www.thingsboard.club
2023-10-26T01:08:23.png

假设 ThingsBoard 以 docker 方式运行,需要通过反向映射来提供服务,为了加强安全性,用 https 和 wss,但是,wss 映射需要注意最后几行配置。

如果你有 ThingsBoard 服务需求或二次开发需求,请与我们联系: 18616669123

<VirtualHost *>
    DocumentRoot /var/www/iot
    ServerName iot.domain
    RewriteEngine on
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]

    <Directory /var/www/iot>
        allow from all
        Options None
        Require all granted
    </Directory>
</VirtualHost>
<VirtualHost *:443>
    DocumentRoot "/var/www/iot"
    ServerName iot.doamin
    <Directory "/var/www/iot">
    allow from all
    Options FollowSymLinks
    Require all granted
    AllowOverride All 
    </Directory>
    SSLEngine on
    SSLCertificateFile /etc/httpd/conf.d/server.crt
    SSLCertificateKeyFile /etc/httpd/conf.d/server.key
    SSLCertificateChainFile /etc/httpd/conf.d/ca.crt

    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:8088/
    ProxyPassReverse / http://127.0.0.1:8088/
    ProxyPass /api/ws ws://127.0.0.1:8088/
    ProxyPassReverse /api/ws ws://127.0.0.1:8088/

    RewriteEngine on
    RewriteCond %{HTTP:Upgrade} =websocket [NC]
    RewriteRule /(.*) ws://127.0.0.1:8088/$1 [P,L]
</VirtualHost>

标签: none

添加新评论