树莓派 使用Nginx + PHP7.0 + Pi Dashboard搭建系统监控平台
发布时间:2018-08-08
作者:Admin
标签: Nginx
PHP
Dashboard
访问量:1000
首先进行系统更新
sudo apt-get update
安装PHP7.0
sudo apt-get install nginx php7.0-fpm php7.0-cli php7.0-curl php7.0-gd php7.0
开启Nginx
service nginx start
备份nginx配置
cp /etc/nginx/sites-available/default /etc/nginx/sites-available/bf_default
修改Nginx配置让nginx可以支持php
将其中的如下内容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.0-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
重启Nginx
service nginx restart
安装Dashboard
SFTP 上传在 GitHub 下载本项目源码。通过 FileZilla 等 FTP 软件将解压出来的目录上传到树莓派的/var/www/html目录下。那么可以通过http://树莓派IP/pi-dashboard访问部署好了的 Pi Dashboard。
如果页面无法显示,可以尝试在树莓派终端给源码添加运行权限,例如你上传之后的路径是/var/www/html/pi-dashboard,则运行。cd /var/www/html
sudo chown -R www-data pi-dashboard
GitHub 部署如果你了解过 GitHub 的基本操作,通过 GitHub 来下载本项目到 Pi 上会相当方便。#如果已安装过 git 客户端可以跳过下一行
sudo apt-get install git
cd /var/www/html
sudo git clone https://github.com/spoonysonny/pi-dashboard.git
即可通过http://树莓派IP/pi-dashboard访问部署好了的 Pi Dashboard。
同样如果页面无法显示,可以尝试在树莓派终端给源码添加运行权限,例如你上传之后的路径是/var/www/html/pi-dashboard,则运行。cd /var/www/html
sudo chown -R www-data pi-dashboard
安装完成后可以看到如下界面