實(shí)驗(yàn)內(nèi)容:
(1)主機(jī)IP
nfs server IP :192.168.29.120 nfs client IP: 192.168.29.110
(2)要求
nfs server共享/data/web/ 、/data/mysql 兩個(gè)目錄 nfs client掛載nfs server共享的/data/web/的文件系統(tǒng)至/var/www/html;部署wordpress。 nfs client掛載nfs server共享的/data/mysql/的文件系統(tǒng)至/var/lib/mysql/,作為數(shù)據(jù)庫(kù)目錄
一 服務(wù)器端配置
1安裝nfs-utils 軟件包
[root@CentOS7 ~]# yum install nfs-utils
2編輯配置文件
共享目錄為/data/web
[root@CentOS7 ~]# vim /etc/exports /data/web/ *(rw,no_root_squash) /data/mysql *(rw,no_root_squash)## “*”表示所有主機(jī)均可連接,no_root_squash表示不壓縮root用戶。
3創(chuàng)建共享目錄
[root@CentOS7 ~]# mkdir -pv /data/web/ [root@CentOS7 ~]# mkdir -pv /data/mysql
4開啟服務(wù)
[root@CentOS7 ~]# systemctl start nfs.service
二 客戶端配置
1 掛載
(1)新建掛載的目錄
[root@CentOS7 ~]# mkdir /var/www/html/
(2)掛載服務(wù)器共享的目錄(/data/web/)至本地/var/www/html
[root@CentOS7 ~]# mount -t nfs 192.168.29.120:/data/web/ /var/www/html/ [root@CentOS7 ~]#mount -t nfs 192.168.29.120:/data/mysql/ /var/lib/mysql/
2 安裝LAMP
采用yum方式進(jìn)行安裝httpd、MariaDB、php、php-mysql,php-mysql用來進(jìn)行php和MariaDB數(shù)據(jù)庫(kù)的連接。
[root@CentOS7 ~]# yum install httpd mariadb-server php php-mysql -y
3 創(chuàng)建新的虛擬主機(jī)
(1)新增虛擬主機(jī)配置文件
[root@CentOS7 ~]# vim /etc/httpd/conf.d/vhost.confDocumentRoot "/var/www/html" ServerName www.mywordpress.com AllowOverride None Require all granted
(2)創(chuàng)建所需目錄
[root@CentOS7 ~]# mkdir /var/www/html
4 檢查語(yǔ)法并啟動(dòng)httpd服務(wù)
(1)檢查語(yǔ)法
[root@CentOS7 ~]# httpd -t
Syntax OK
(2)啟動(dòng)httpd服務(wù)
[root@CentOS7 ~]# systemctl start httpd.service
5下載wordpress壓縮包,wordpress-4.7.4-zh_CN.tar.gz
(1)解壓縮
[root@CentOS7 ~]# tar -xf wordpress-4.7.4-zh_CN.tar.gz
(2)把解壓縮后得到的文件(wordpress)復(fù)制到DocumentRoot(/var/www/html/)下
[root@CentOS7 ~]# cp -a wordpress /var/www/html/
(3)修改目錄wordpress/wp-content的權(quán)限,確保博客可以正常上傳圖片,發(fā)表文章
[root@CentOS7 ~]# chmod o+w /var/www/html/wordpress/wp-content/
6 啟動(dòng)MariaDB服務(wù)
[root@CentOS7 ~]# systemctl start mariadb
7修改wordpress配置文件
(1)就讓W(xué)ordPress目錄(/var/www/wordpress/html/)
[root@CentOS7 ~]# cd /var/www/html/wordpress
(2)復(fù)制wp-config-sample.php模板文件為wp-config.php,然后編輯
[root@CentOS7 ~]# vim /var/www/html/wordpress/wp-config.php // ** MySQL 設(shè)置 - 具體信息來自您正在使用的主機(jī) ** // /** WordPress數(shù)據(jù)庫(kù)的名稱 */ define('DB_NAME', 'wordpress'); /** MySQL數(shù)據(jù)庫(kù)用戶名 */ define('DB_USER', 'test1'); /** MySQL數(shù)據(jù)庫(kù)密碼 */ define('DB_PASSWORD', '123456'); /** MySQL主機(jī) */ define('DB_HOST', 'localhost');
8 在數(shù)據(jù)庫(kù)中創(chuàng)建數(shù)據(jù)庫(kù)和用戶
(1)創(chuàng)建數(shù)據(jù)庫(kù)
MariaDB [(none)]> create database wordpress; Query OK, 1 row affected (0.00 sec)
(2)創(chuàng)建用戶
MariaDB [(none)]> create user 'test1'@'localhost' identified by '123456'; Query OK, 0 rows affected (0.00 sec)
(3)給用戶授權(quán)
MariaDB [(none)]> grant all on wordpress.* to 'test1'@'localhost'; Query OK, 0 rows affected (0.01 sec)
9 測(cè)試
在瀏覽器中輸入http://192.168.29.110/wordpress/
鏈接:https://www.cnblogs.com/Sunzz/p/7281790.html
-
服務(wù)器
+關(guān)注
關(guān)注
13文章
9797瀏覽量
88041 -
主機(jī)
+關(guān)注
關(guān)注
0文章
1038瀏覽量
36002 -
文件系統(tǒng)
+關(guān)注
關(guān)注
0文章
297瀏覽量
20401
原文標(biāo)題:NFS搭配WordPress:10分鐘搭建企業(yè)級(jí)高可用博客系統(tǒng)
文章出處:【微信號(hào):magedu-Linux,微信公眾號(hào):馬哥Linux運(yùn)維】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。
發(fā)布評(píng)論請(qǐng)先 登錄
如何開啟WordPress調(diào)試模式(報(bào)錯(cuò)提示)?
嵌入式Linux NFS方式下應(yīng)用程序的實(shí)現(xiàn)
vps搭建wordpress網(wǎng)站的3個(gè)步驟介紹
嵌入式Linux NFS掛載

Sync QCloud COS WordPress云存儲(chǔ)插件

Wordpress On BAE針對(duì)百度云BAE修改的WordPress中文版

WordPress正在測(cè)試對(duì)SQLite的支持
恒訊科技介紹:虛擬主機(jī)托管WordPress的常見問答
hanewin nfs server下載
如何三步實(shí)現(xiàn)高性能 WordPress 網(wǎng)站的部署

如何實(shí)現(xiàn)NFS服務(wù)搭建

評(píng)論