玩转树莓派(三)部署仪表盘
作者:互联网
玩转树莓派(三)部署仪表盘
1 Pi 仪表盘
官方安装教程:
https://make.quwj.com/project/10
2 安装依赖
- 安装 Nginx 和 PHP
sudo apt-get update
sudo apt-get install nginx php7.3-fpm php7.3-cli php7.3-curl php7.3-gd php7.3-cgi
sudo service nginx start
sudo service php7.3-fpm restart
通过http://树莓派IP 访问到 Nginx 的默认页/var/www/html下的内容
- 配置Nginx
cd /etc/nginx/sites-available
sudo vim default
将其中的如下内容
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
替换为
location / {
index index.html index.htm index.php default.html default.htm default.php;
}
location ~\.php$ {
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
- 重启Nginx
sudo service nginx restart
3 部署 Pi Dashboard
在 Nginx 目录中通过 GitHub 部署
- 安装 git 客户端
sudo apt-get install git
- 部署 Pi Dashboard
cd /var/www/html
sudo git clone https://github.com/nxez/pi-dashboard.git
即可通过 http://树莓派IP/pi-dashboard 访问部署好了的 Pi Dashboard
实现效果:
(*)3. 若页面无法显示,可尝试在树莓派终端给源码添加运行权限,例上传之后的路径是 /var/www/html/pi-dashboard,则运行:
cd /var/www/html
sudo chown -R www-data pi-dashboard
标签:树莓,sudo,php7.3,Nginx,html,玩转,仪表盘,Pi 来源: https://blog.csdn.net/kerwin_tang97/article/details/113922526