安装 php
sudo apt-get install php
配置 nginx,/etc/nginx/site-available/default
,按照里面的注释,把 php 配置好
安装 MariaDB,参考[^1]
sudo apt-get install mariadb-server mariadb-client
安装数据库实例
sudo mysql_secure_installation
查看MariaDB数据库服务状态
sudo systemctl status mysql
导入数据库
sudo mysql -u root -p password < /home/backup.sql
设置mysql随系统服务启动
sudo update-rc.d mysql defaults
安装 apache2 的命令
sudo apt-get install apache2
配置apache2与php命令
sudo apt-get install libapache2-mod-php
重启apache2命令
sudo /etc/init.d/apache2 restart
配置 apache2 重写规则,运行命令 a2enmod rewrite
, 增加内容到 /etc/apache2/sites-available/000-default.conf
<VirtualHost *:9098>
<Directory "/var/www/yancloud">
Options All
AllowOverride All
</Directory>
在目录下面增加 .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
php 连接服务器报错 cound not find driver
, 解决方案
sudo apt-get install php7.0-mysql
php 解析 xml 模块
sudo apt-get install php7.0-xml
[^1] apt-get安装MariaDB: https://blog.csdn.net/dream361/article/details/65445168