快速部署命令:
# 安装php7.2-fpmsudo apt -y install software-properties-common apt-transport-https lsb-release ca-certificatessudo add-apt-repository ppa:ondrej/phpsudo apt-get updatesudo apt install php7.2-fpm php7.2-mysql php7.2-curl php7.2-gd php7.2-mbstring php7.2-xml php7.2-xmlrpc php7.2-zip php7.2-opcache -ysed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php/7.2/fpm/php.inisystemctl restart php7.2-fpm# 安装apache2sudo apt-get install apache2# 安装Apache2模块,使其支持phpsudo apt-get install libapache2-mod-php7.2# 安装MySQLsudo apt-get install mysql-server
启动mod_rewrite模块,解决除了index.php其他页面404的问题:
mod_rewrite
sudo a2enmod rewrite # 修改配置文件/etc/apache2/apache2.conf<Directory /var/www/> Options Indexes FollowSymLinks # 主要是下面这行,改为all AllowOverride all Require all granted</Directory># 最后重启Apache2服务即可.sytemctl restart apache2