安装

安装nginx、mysql、php

yum install nginx mariadb mariadb-server php php-fpm php-mysql

配置

打开nginx的配置文件

vim /etc/nginx/nginx.conf

修改网站目录

root  /var/www/html

server块中修改

...
location / {
    index index.php index.html;
}
...
...
location ~ \.php(.*)$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_param  PATH_INFO  $fastcgi_path_info;
    fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
    include        fastcgi_params;
}
...

启动

启动服务关闭服务开机自启关闭自启
systemctl start nginxsystemctl stop nginxsystemctl enable nginxsystemctl disable nginx
systemctl start mariadbsystemctl stop mariadbsystemctl enable mariadbsystemctl disable mariadb
systemctl start php-fpmsystemctl stop php-fpmsystemctl enable php-fpmsystemctl disable php-fpm

配置数据库

进入数据库

mysql -u root -p

默认密码为空,修改密码

set password = password('root')