前言

为了监测树莓派的运行情况,使用树莓派实验室的 Pi Dashboard 来实现,通过 Nginx 反向代理。

创建容器

  • 基于 debian 容器:

    sudo docker run -i -t --name PiDashboard -p 10000:80 --net amber-net --ip 172.20.0.40 -d debian:latest
    

容器内安装工具

  • 容器内执行命令:

    apt install apache2 php libapache2-mod-php git
    

克隆 Git 项目

  • 作者网站: Pi Dashboard

  • 容器内执行命令:

    cd /var/www/html
    git clone https://github.com/spoonysonny/pi-dashboard.git
    

Nginx 代理

  • default.conf 文件:

    upstream rasamber-pi-dashboard{
            server 192.168.1.110:10000;
    }
    
    server{
      listen 80;
      return 301 https://$host$request_uri;
    }
    
    server{
      listen 443 ssl;
      server_name rasamber;
      
      # SSL 设置
      ......
    
      location /pi-dashboard/ {
        proxy_pass http://rasamber-pi-dashboard/pi-dashboard/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   Cookie $http_cookie;
        proxy_cookie_path /pi-dashboard/ /;
      }
    }
    

相关文章:

  • 2022-01-28
  • 2022-01-10
  • 2022-12-23
  • 2021-04-03
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2021-05-05
猜你喜欢
  • 2022-12-23
  • 2022-02-26
  • 2022-12-23
  • 2021-10-31
  • 2021-12-19
  • 2021-12-07
  • 2021-06-24
相关资源
相似解决方案