当前位置:   article > 正文

Armbian(Debian 9)安装nginx+MariaDB10.3+php7.3_armbian安装nginx

armbian安装nginx

1.首先修改国内的源

vi /etc/apt/sources.list
  • 1

修改为下面的源

deb http://mirrors.ustc.edu.cn/debian buster main contrib non-free
deb http://mirrors.ustc.edu.cn/debian buster-updates main contrib non-free
deb http://mirrors.ustc.edu.cn/debian buster-backports main contrib non-free
deb http://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-free
  • 1
  • 2
  • 3
  • 4

2.安装nginx

apt update
apt install nginx -y
  • 1
  • 2

然后在浏览器输入你服务器的ip地址,会显示nginx运行成功。

3.安装MariaDB

apt-get install  mariadb-server -y
  • 1

4.安装php7.3

debain9想要安装php7.3,需要先添加软件源:

apt install ca-certificates apt-transport-https -y
wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add 
echo "deb https://packages.sury.org/php/ stretch main" | tee /etc/apt/sources.list.d/php.lis
apt update
apt install php7.3-fpm -y
apt install php7.3 php7.3-mysql php7.3-gd php7.3-xml php7.3-cgi php7.3-cli php7.3-curl php7.3-zip php7.3-mbstring unzip -y
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

启动服务

systemctl enable php7.3-fp
systemctl start php7.3-fpm
  • 1
  • 2

5.配置Nginx+PHP7+MariaDB
(1)配置Nginx解析php
编辑vi /etc/nginx/sites-enabled/default

location ~ [^/]\.php(/|$)
        {
        fastcgi_pass   unix:/run/php/php7.3-fpm.sock;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_index index.php;
        include        fastcgi_params;
		set $path_info "";
		set $real_script_name $fastcgi_script_name;
        if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
           set $real_script_name $1;
           set $path_info $2;
         }
         fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
         fastcgi_param SCRIPT_NAME $real_script_name;
         fastcgi_param PATH_INFO $path_info;
        }     
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

(2)MariaDB配置
shell登录mysql:mysql -u root -p默认无密码,直接回

select Host,User,plugin from mysql.user where User='root';
  • 1

这个时候会发现plugin(加密方式)是unix_socket
#重置加密方法

update mysql.user set plugin='mysql_native_password';  
  • 1

#设置新密码

update mysql.user set password=PASSWORD("newpassword") where User='root'; 
  • 1

#允许远程访问

use mysql;
update user set host='%' where user='root' and host='localhost';
flush privileges;
  • 1
  • 2
  • 3

退出数据库后

vi /etc/mysql/mariadb.conf.d/50-server.cnf
  • 1

将bind-address = 127.0.0.1 改为: bind-address = 0.0.0.0
enjoy~
至此,LNMP就搭建完了,这是我们之后再添加各种服务(自建网盘/博客/论坛/等等等等)的基础。

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号