server {
listen 80;
listen [::]:80;

server_name iot.xx.com;

location / {
    # try_files $uri $uri/ =404;
    proxy_pass http://39.104.xx.84:9090;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
}

}

首先要有docker环境,这个环境如何装,这里就不说了,不会装可以通过阿里云购买docker镜像

Depending on the database used there are three type of ThingsBoard single instance docker images:

  • thingsboard/tb-cassandra – 超级大的single instance of ThingsBoard with Cassandra database.The most performant and recommended option but requires at least 4GB of RAM. 8GB is recommended.
  • thingsboard/tb-postgres – 一般的single instance of ThingsBoard with PostgreSQL database.Recommended option for small servers with at least 1GB of RAM and minimum load (few messages per second). 2-4GB is recommended.
  • thingsboard/tb – 最小型的 single instance of ThingsBoard with embedded HSQLDB database.Note: Not recommended for any evaluation or production usage and is used only for development purposes and automatic tests.
$ docker run -it -p 9090:9090 -p 1883:1883 -p 5683:5683/udp -v ~/.mytb-data:/data -v ~/.mytb-logs:/var/log/thingsboard --name mytb --restart always thingsboard/tb-cassandra
 docker run -it -p 9090:9090 -p 1883:1883 -p 5683:5683/udp -v ~/.mytb-data:/data -v ~/.mytb-logs:/var/log/thingsboard --name mytb --restart always thingsboard/tb-cassandra

Where:

  • docker run – run this container
  • -it – attach a terminal session with current ThingsBoard process output
  • -p 9090:9090 – connect local port 9090 to exposed internal HTTP port 9090
  • -p 1883:1883 – connect local port 1883 to exposed internal MQTT port 1883
  • -p 5683:5683 – connect local port 5683 to exposed internal COAP port 5683
  • -v ~/.mytb-data:/data – mounts the host’s dir ~/.mytb-data to ThingsBoard DataBase data directory
  • -v ~/.mytb-logs:/var/log/thingsboard – mounts the host’s dir ~/.mytb-logs to ThingsBoard logs directory
  • --name mytb – friendly local name of this machine
  • --restart always – automatically start ThingsBoard in case of system reboot and restart in case of failure.
  • thingsboard/tb-cassandra – docker image, can be also thingsboard/tb-postgres or thingsboard/tb

After executing this command you can open http://{your-host-ip}:9090 in you browser (for ex. http://localhost:9090). You should see ThingsBoard login page. Use the following default credentials:

You can always change passwords for each account in account profile page.

localhost:8080默认情况下,ThingsBoard会监听。出于安全考虑,最好通过反向代理服务仪表板。本指南将使用NGINX,但可以使用任何网络服务器。

  • 安装NGINX: sudo apt install nginx
  • /etc/nginx/conf.d/thingsboard.conf使用文本编辑器创建并编辑它以匹配下面的示例。替换example.com为您的Linode的公共IP地址或FQDN。 /etc/nginx/conf.d/thingsboard.conf
server {
    listen 80;
    listen [::]:80;

    server_name example.com;

    location / {
        # try_files $uri $uri/ =404;
        proxy_pass http://localhost:8080/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
    }
}
  • 重启NGINX: sudo systemctl restart nginx