ip a
查看自己的ens
nmcli c modify ens33 ipv4.method manual ipv4.addresses '192.168.132.131/24' ipv4.gateway '192.168.132.2' ipv4.dns '114.114.114.114'
nmcli c modify ens33 ipv4.method manual ipv4.addresses '192.168.132.131/24' ipv4.gateway '192.168.132.2' ipv4.dns '114.114.114.114'
# 在192.168.132.130(Server-Web)中配置
[root@server-Web ~]# ssh-keygen -t rsa # 生成公钥私钥,一路回车
[root@server-Web ~]# ssh-copy-id 192.168.132.131
[root@server-Web ~]# ssh 192.168.132.131
[root@server-Web ~]# exit
# 在192.168.132.131(Server-NFS-DNS)中配置
[root@server-NFS-DNS ~]# ssh-keygen -t rsa
[root@server-NFS-DNS ~]# ssh-copy-id 192.168.132.130
[root@server-NFS-DNS ~]# ssh 192.168.132.130
网址:
https://cn.wordpress.org/
,下载后为
zip
压缩文件
将
wordpress
上传到
192.168.132.131
(
Server-NFS-DNS
)端的
/
目录下
解压缩:
[root@Server-NFS-DNS ~]# cd /
[root@Server-NFS-DNS /]# unzip wordpress-6.1-zh_CN.zip
[root@Server-NFS-DNS /]# cd wordpress
[root@Server-NFS-DNS /]# ls
[root@Server-NFS-DNS wordpress]# yum install rpcbind -y 系统自带但建议下载查看一下
[root@Server-NFS-DNS wordpress]# yum install nfs-utils -y (系统自带但建议下载查看一下)
[root@Server-NFS-DNS /]# cd ~
[root@Server-NFS-DNS ~]# vim /etc/exports # 编辑配置文件
/wordpress 192.168.132.129(rw,sync,all_squash) # 添加
[root@Server-Web ~]# yum install rpcbind -y
[root@Server-Web ~]# yum install nfs-utils -y
[root@Server-Web ~]# showmount -e 192.168.132.131 # 查看
[root@Server-Web ~]# mkdir /wp # 新建本地挂载目录
[root@Server-Web ~]# mount -t nfs 192.168.132.131:/wordpress /wp # 挂载
挂在失败:mount.nfs: Connection refused
以上问题可能是有网速问题在里面
以上问题可能是有网速问题在里面
[root@Server-Web ~]# cd /wp
[root@Server-Web wp]# ls
[root@Server-Web wp]# cd ~
[root@Server-Web ~]# firewall-cmd --permanent --zone public --add-service=http #
放行
[root@Server-Web ~]# firewall-cmd --reload
[root@Server-Web ~]# vim /etc/nginx/nginx.conf # 编辑nginx配置文件
[root@Server-Web ~]# cd /wp
[root@Server-Web wp]# cp wp-config-sample.php wp-config.php # 根据模板拷贝配置文件
# 编辑wp-config.php配置文件
[root@Server-Web wp]# vim wp-config.php
# 定位23行修改后半部分
define('DB_NAME', 'wordpress'); # WordPress数据库的名称
define('DB_USER', 'test1'); # MySQL数据库用户名
define('DB_PASSWORD', '123456'); # MySQL数据库密码
[root@Server-Web wp]# cd ~
[root@Server-Web ~]# systemctl start mariadb
[root@Server-Web ~]# mysql
MariaDB [(none)]> create database wordpress; # 创建数据库,尾部有分号
MariaDB [(none)]> create user 'test1'@'localhost' identified by '123456'; # 第一
个''为数据库账号,@后面的''内容为数据库可以登录的地址,localhost意为只能本机登录。用户和密码与
wordpress配置文件一样,
MariaDB [(none)]> grant all on wordpress.* to 'test1'@'localhost'; # 给用户授权
MariaDB [(none)]> exit # 退出
[root@Server-Web ~]# systemctl restart mariadb
[root@Server-Web ~]# systemctl restart nginx
vim /etc/named.rfc1912.zones
systemctl restart named