四、树莓派搭建LNMP+Pi-dashboard

文章参考:https://www.jianshu.com/p/0af5389cdb37

一、安装php7.3

1.添加apt源:

sudo vim /etc/apt/sources.list.d/raspi.list

deb http://archive.raspberrypi.org/debian/ buster main
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
deb-src http://archive.raspberrypi.org/debian/ buster main
#deb http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui
#deb-src http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui
deb http://mirrordirector.raspbian.org/raspbian/ buster main contrib non-free rpi

2.更新软件包列表

sudo apt-get update

3.安装php7.3

sudo apt install -y -t buster php7.3-fpm php7.3-curl php7.3-gd php7.3-intl php7.3-mbstring php7.3-mysql php7.3-imap php7.3-opcache php7.3-sqlite3 php7.3-xml php7.3-xmlrpc php7.3-zip

4.测试是否安装成功

pi@raspberrypi:/ $ php -v
PHP 7.3.14-1~deb10u1 (cli) (built: Feb 16 2020 15:07:23) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.14, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.14-1~deb10u1, Copyright (c) 1999-2018, by Zend Technologies

二、安装nginx

1.安装nginx

sudo apt-get install nginx

2.测试nginx是否正常运行

curl 127.0.0.1

3.配置nginx,使其能解析PHP

sudo vim /etc/nginx/sites-enabled/default 
#在server内加入或修改以下字段
server {
	location ~ \.php$ {
		include snippets/fastcgi-php.conf;
	#
	#	# With php-fpm (or other unix sockets):
		fastcgi_pass unix:/run/php/php7.3-fpm.sock;
	#	# With php-cgi (or other tcp sockets):
	#	fastcgi_pass 127.0.0.1:9000;
	}
}
#在改行后添加index.php
	index index.html index.htm index.nginx-debian.html index.php;

4.重载nginx,不报错就可以正常使用

sudo nginx -s reload

5.测试是否可以解析PHP

sudo vim /var/www/html/index.php 

<?php
echo time();

pi@raspberrypi:~ $ curl 127.0.0.7/index.php
1590822761pi@raspberrypi:~ $ 

三、安装Mariadb数据库

1.安装Mariadb

sudo apt-get install mariadb-server mariadb-client

2.初始化数据库

sudo mysql_secure_installation

根据提示输入yes或no以及管理员密码

3.登陆数据库

pi@raspberrypi:~ $ sudo mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 36
Server version: 10.3.22-MariaDB-0+deb10u1 Raspbian 10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

四、安装pi-dashboard

1.在github首页直接搜索pi-dashboard
在这里插入图片描述
2.找到pi-dashboard并进入
在这里插入图片描述
3.复制文件链接地址
在这里插入图片描述
https://github.com/spoonysonny/pi-dashboard.git

4.下载至nginx中

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

5.在浏览器中输入:树莓派IP/pi-dashboard进行访问
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值