树莓派3安装php,树莓派3Raspbian-Buster安装lnmp环境搭建Typecho博客

安装 Nginx、PHP7和Mysqlsudo apt-get update

sudo apt-get install nginx php7.3-fpm php7.3-curl php7.3-gd php7.3-mbstring php7.3-mysql php7.3-imap php7.3-opcache php7.3-xml php7.3-xmlrpc php7.3-zip uw-mailutils php-pear mariadb-server -y

sudo systemctl start php7.3-fpm.service

安装好后先配置Mariadb//安装完毕后,暂时还不能使用,需要通过sudo mysql 登录进行修改密码,授权等操作,这些操作与其他MySQL是一样的。

$ sudo mysql

MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO root@'localhost' IDENTIFIED BY '123456';

MariaDB [mysql]> FLUSH PRIVILEGES;

MariaDB [mysql]> exit;

//需要注意的是,在raspbian中,MySQL默认是无法进行远程登陆的,需要修改配置

$ sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf //默认的配置文件位置

##bind-address = 127.0.0.1 //需要进行注释的内容

配置好Mariadb后启动数据库$ sudo systemctl start mysql.service

$ sudo systemctl restart mysql.service

$ sudo systemctl stop mysql.service

$ sudo systemctl enable mysql.service

配置Nginxsudo nano /etc/nginx/sites-available/default

ctrl+w查找index,在后面加上index.phpindex index.html index.htm index.php;

再在文件中增加一下内容:# Typecho伪静态

if (!-e $request_filename) {

rewrite ^(.*)$ /index.php$1 last;

}

# PHP配置

location ~ .*\.php(\/.*)*$ {

include snippets/fastcgi-php.conf;

fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;

}

启动nginxsudo systemctl start nginx

要注意的是,typecho因为涉及到rewrite的问题,需要支持pathinfo,所以他的配置文件并不能写成最简单的location ~ .*\.php$

而是要改成location ~ .*\.php(\/.*)*$

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值