安装php:
sudo apt install php7.0-mbstring php7.0-gd php7.0-mbstring php7.0-mysql php-redis
安装MariaDB:
$ sudo apt install mariadb-server
启动MariaDB服务:
$ sudo systemctl restart mysql
$ sudo systemctl enable mysql
初始化MariaDB
$ sudo mysql_secure_installation
默认root密码为空;然后设置root密码和其他选项:
- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y
安装ngnix: sudo apt insall ngnix
修改php-fpm的配置文件
vim /etc/php/7.0/fpm/pool.d/www.conf
listen = /tmp/php-fcgi.sock
;listen = /tmp/php-fcgi.sock
listen = 127.0.0.1:9000
修改nginx的配置文件
sudo vim /etc/nginx/sites-enabled/default
server
{
listen 80;
server_name liveknight.xyz;
index index.php;
root /var/www/html/dream/public/;
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
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;
}
}
报错 403
sudo chmod -R 775 /var/www/html