1.准备wordpress的代码,放到指定位置
[root@web01 ~]# mkdir /code
[root@web01 ~]# tar xf wordpress-5.2.3-zh_CN.tar.gz -C /code/
2.修改权限,统一用户www(自己设定用户)
1.)创建用户
[root@web01 ~]# groupadd -g 666 www
[root@web01 ~]# useradd -u666 -g666 www
2.)修改nginx运行身份
[root@web01 ~]# sed -i '/^user/c user www;' /etc/nginx/nginx.conf
3.)修改php-fpm的运行身份
[root@web01 ~]# sed -i '/^user/c user = www' /etc/php-fpm.d/www.conf
[root@web01 ~]# sed -i '/^group/c group = www' /etc/php-fpm.d/www.conf
4.)重启nginx和php
[root@web01 ~]# systemctl restart nginx php-fpm
5.)授权代码的权限
[root@web01 ~]# chown -R www.www /code/wordpress/
3.安装、启动数据库,创建一个库
[root@web01 php]# yum install mariadb mariadb-server -y
[root@web01 php]# systemctl start mariadb
[root@web01 php]# systemctl enable mariadb
[root@web01 php]# mysqladmin password goodyang
[root@web01 php]# mysql -uroot -pgoodyang
MariaDB [(none)]> create database wordpress;
4.配置nginx,添加wordpress网站
[root@web01 ~]# cat /etc/nginx/conf.d/blog.yang.com.conf
server {
listen 80;
server_name blog.yang.com;
root /code/wordpress;
client_max_body_size 100m;
location / {
index index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
5.测试语法、重启
[root@web01 ~]# nginx -t
[root@web01 ~]# systemctl restart nginx
6.host劫持(没有域名)