lnmp + nfs deploy wordpress

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/SarahYYP/article/details/102752725

linux nfs mount used to build the realization wordpress

Use two servers, one to do web [lnmp], another do nfs
Operating System: CentOS 7
wordpress-4.7.2-zh_CN.tar.gz
Database: mariadb
Server: 192.168.184.137 web
192 168 184 150 in

1, the two machines are configured

(1) DNS, and test whether the two machines communicate

[root@localhost ~]# vim /etc/hosts
192.168.184.137   web
192.168.184.150   nas
[root@localhost ~]# ping -c1 192.168.184.150      #两台机器相通
PING 192.168.184.150 (192.168.184.150) 56(84) bytes of data.
64 bytes from 192.168.184.150: icmp_seq=1 ttl=64 time=0.555 ms
--- 192.168.184.150 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.555/0.555/0.555/0.000 ms

(2) turn off the firewall and selinux

[root@localhost ~]# systemctl stop firewalld       # 关闭防火墙
[root@localhost ~]# systemctl disable firewalld    # 开机自动关闭防火墙
[root@localhost ~]# setenforce 0                   # 临时关闭selinux
[root@localhost ~]# vim /etc/selinux/config        # 永久关闭selinux,要重启机器才生效(reboot)
SELINUX=disabled                                   # 将enforcing修改为disabled 

2, the end nfs

(1) modify the machine to parse the user name (reconnection after completion of editing)

[root@nas ~]# hostnamectl set-hostname nas

(2) Installation and the rpcbind NFS, and starts the service (a promoter sequence, start nfs-utils, starting the rpcbind)

[root@nas ~]# yum -y install nfs-utils rpcbind  
[root@nas ~]# systemctl restart nfs-utils
[root@nas ~]# systemctl enable nfs-utils
[root@nas ~]# systemctl restart rpcbind
[root@nas ~]# systemctl enable rpcbind

(3) create / web / directory in the root as a mount the file, unzip the file download and upload wordpress

[root@nas ~]# mkdir /web
##上传wordpress
[root@nas ~]# ls     
anaconda-ks.cfg  wordpress-4.7.2-zh_CN.tar.gz
[root@nas ~]# tar xf wordpress-4.7.2-zh_CN.tar.gz 
[root@nas ~]# mv wordpress /web/
[root@nas ~]# ls /web/
wordpress
[root@nas ~]# chmod -R 777 /web/

(4) modify the / etc / exports file (file sharing), and starts nfs-server

[root@nas ~]# vim /etc/exports
/web/wordpress   192.168.184.0/24(rw,sync,no_root_squash)  # 不压制root(当client端使用root挂载时,也有root权限)挂载是root ,同样保持root权限
[root@nas ~]# systemctl restart nfs-server
[root@nas ~]# systemctl enable nfs-server
[root@nas ~]# exportfs -v            # 查看共享文件的配置是否正确 ,出现以下信息及正确
/web/wordpress	192.168.184.0/24(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash)

2, at the end of the web

(1) modify the machine to parse the user name (reconnection after completion of editing)

[root@localhost ~]# hostnamectl set-hostname nas

(2) the installation environment, restart http service

[root@web ~]# yum -y install nfs-utils httpd mariadb-server mariadb php php-mysql gd php-gd php-fpm     
[root@web ~]# systemctl start httpd
[root@web ~]# systemctl enable httpd

(3) View Share ---- showmount -e NFS storage ip address, and restart the httpd service

[root@web ~]# showmount -e 192.168.184.150    #查看到信息,配置正确
Export list for 192.168.184.150:
/web/wordpress 192.168.184.0/24

(4) permanent mount, mount view information, and restart the service

[root@web ~]# vim /etc/fstab    #在最后一行添加以下信息
nas:/web/wordpress        /var/www/html       nfs     defaults      0     0 
[root@web ~]# mount -a 
[root@web ~]# df -h        #可以看到在最后一行可以有挂载信息
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   17G  1.7G   16G  10% /
devtmpfs                 1.4G     0  1.4G   0% /dev
tmpfs                    1.4G     0  1.4G   0% /dev/shm
tmpfs                    1.4G  8.6M  1.4G   1% /run
tmpfs                    1.4G     0  1.4G   0% /sys/fs/cgroup
/dev/sda1               1014M  143M  872M  15% /boot
tmpfs                    284M     0  284M   0% /run/user/0
nas:/web/wordpress        17G  1.4G   16G   9% /var/www/html

(5) may be ip (192.168.184.137) of web browser access, i.e., the configuration shown in FIG successful

Here Insert Picture Description
(6) arranged on the database

[root@web ~]# systemctl restart mariadb
[root@web ~]# mysqladmin -uroot password "123"
[root@web ~]# mysql -uroot -p123
MariaDB [(none)]> create database wordpress;
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> \q
[root@web ~]# systemctl restart mariadb

3, the browser test - 192.168.184.137, in your browser configuration wordpress
Here Insert Picture DescriptionHere Insert Picture DescriptionHere Insert Picture DescriptionHere Insert Picture DescriptionHere Insert Picture Description

Appears above the page is configured successfully. Service completed structures.

_ _ _ _

Guess you like

Origin blog.csdn.net/SarahYYP/article/details/102752725