sudo apt-get install -y mariadb-server-10.3 nginx php7.3-fpm php7.3-cli php7.3-curl php7.3-gd php7.3-cgi php7.3-mbstring php7.3-bcmath php7.3-json php7.3-sqlite3 php7.3-xml php7.3-zip
nginx添加php支持
sudo nano /etc/nginx/sites-available/default
#将location / { *** } 内容替换为:
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;
}
更改MySQL密码,执行 mysql 命令:
MariaDB [(none)]> use mysql;
MariaDB [mysql]> update user set plugin='mysql_native_password' where user='root';
MariaDB [mysql]> UPDATE user SET password=PASSWORD('你想要设定的密码') WHERE user='root';
MariaDB [mysql]> flush privileges;
MariaDB [mysql]> exit;
设置开机启动&运行
sudo systemctl enable nginx.service
sudo systemctl enable php7.3-fpm.service
sudo systemctl enable mariadb-server-10.3.service
sudo systemctl start nginx.service
sudo systemctl start php7.3-fpm.service
sudo systemctl start mariadb-server-10.3.service