web 服务器
首先创建nginx用户
useradd nginx -u 1111 -s /sbin/nologin -M
下载nginx 跟php
yum install nginx -y
yum install php-fpm -y
yum install php-mysql -y
更改php-fpm 的用户跟用户组
vim /etc/php-fpm.d/www.conf
39 user = nginx
40 ; RPM: Keep a group allowed to write in log dir.
41 group = nginx
42
进入nginx的配置目录 配置文件
cd /etc/nginx/conf.d/
vim blog.conf
server {
listen 80;
server_name blog.ncs.com;
location / {
root html/blog;
index index.php index.html index.htm;
}
location ~ \.php$ {
root html/blog;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
进入站点目录配置
cd /usr/share/nginx/html
chown -R nginx.nginx /usr/share/nginx/html
mkdir blog
上传wordpress 安装包
unzip 解压
把解压后的wordpress里的东西都移到blog
启动nginx | php-fpm 并开机自启动
systemctl start nginx
systemctl enable nginx
#systemctl status nginx
systemctl start php-fpm
systemctl enable php-fpm
#systemctl status php-fpm
数据库服务器
下载数据库服务
yum install mariadb-server
启动服务 开机自启
systemctl start mariadb.service
systemctl enable mariadb.service
systemctl status mariadb.service
创建登录mysql密码
mysqladmin -u root password '123456'
创建数据表 给数据表创建用户密码跟哪个网段可以连接
mysql -uroot -p123456
create database wordpress;
grant all privileges on wordpress.* to wordpress@'172.16.1.%' identified by '123456';
flush privileges;
exit
show databases; 查看当前所有的数据库
select user(); 查看当前的登录用户
flush privileges; 刷新权限,使得创建用户生效
show grants for wordpress@'查看用户对应的权限'
select user,host from mysql.user; 查看数据库里创建的wordpress用户