系统:
Ubuntu 20.0
安装Apache2, PHP
$ apt update
$ apt install apache2 mysql-server php libapache2-mod-php mcrypt php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
$ cd /etc/apache2/sites-available
添加一个网站,如:qting.conf
$ vim qting.conf
复制以下代码,这其中包括了rewrite
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName www.qting.com
ServerAlias qting.com
DocumentRoot /var/www/html/qting
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html/qting>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
如果80端口被占用,或者更改apache2的端口
$ vim /etc/apache2/ports.conf
Listen 8080
$ a2enmod rewrite && a2ensite Yoursite.conf
$ systemctl reload apache2
Mysql:
$ create database YourDatabaseName;
$ create user ‘YourUsername’@’localhost’ identified by ‘YourPassword’;
$ grant all privileges on DatabaseName.* to ‘YourUsername’@’localhost’
$ flush privileges