iT邦幫忙

第 11 屆 iThome 鐵人賽

DAY 27
0
IoT

Raspberry Pi最佳入門與應用系列 第 27

Day27 樹莓派的儀表板 Pi-Dashboard

昨天實作了一個樹莓派的監控系統 RPi-Monitor,今天實作另一個稱做 PiDashboard的儀表板系統。

1.安裝 Nginx 和 PHP

sudo apt-get update
https://ithelp.ithome.com.tw/upload/images/20190928/20119848XkXWXzuD7Y.png
sudo apt-get install nginx php7.0-fpm php7.0-cli php7.0-curl php7.0-gd php7.0-mcrypt php7.0-cgi
https://ithelp.ithome.com.tw/upload/images/20190928/20119848u62d7Z1bls.png
sudo service nginx start
https://ithelp.ithome.com.tw/upload/images/20190928/201198489ZSsy6hZBI.png
sudo service php7.0-fpm restart
https://ithelp.ithome.com.tw/upload/images/20190928/20119848x1ivkkd0OK.png

2.修改nginx的設定

sudo nano /etc/nginx/sites-available/default
將檔案內的以下內容
https://ithelp.ithome.com.tw/upload/images/20190928/20119848UBvn6IlGcq.png
修改成
location / {
index index.html index.htm index.php default.html default.htm default.php;
}

location ~.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
(須將#location ~.php$前方的#去掉)
https://ithelp.ithome.com.tw/upload/images/20190928/20119848ZGRnIXo0fF.png

存檔並且重新啟動 nginx 服務
sudo service nginx restart
https://ithelp.ithome.com.tw/upload/images/20190928/20119848Gyrs1VNkK1.png
下載安裝 Pi Dashboard主程式
cd /var/www/html
sudo git clone https://github.com/spoonysonny/pi-dashboard.git
https://ithelp.ithome.com.tw/upload/images/20190928/20119848En1vj9242N.png

打開瀏覽器輸入http://you_raspberry_ip/pi-dashboard/
(以我的樹莓派為例: http://192.168.43.136/pi-dashboard/)
https://ithelp.ithome.com.tw/upload/images/20190928/20119848M6qkYinwpu.png


上一篇
Day26 樹莓派的監控系統 RPi-Monitor
下一篇
Day28 樹莓派測量溫濕度
系列文
Raspberry Pi最佳入門與應用30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言