十六周作业

------------恢复内容开始------------

前端有一个 LAMP 架构通过 wordpress 来部署,后端构建一个 NFS 服务器实现要求将用户上传的图片保存至后端 NFS 服务器上。

#搭建LAMP

yum install -y httpd php php-mysqlnd mariadb-server

#centos8 服务器上启用prefork模式

vim /etc/httpd/conf.modiles/00-mpm.conf

#禁用mod_php5

#vim /etc/httpd/conf.d/php.conf

#vim /var/www/html/lamp.php

<?php

try {

$user='root';

$pass='';

$dbh = new PDO('mysql:host=localhost;dbname=mysql', $user,$pass);

foreach($dbh->query('SELECT user,host from user')as $row) {

print_r($row);

}

$dbh = null;

} catch (PDOException $e) {

print "Error!: " . $e->getMessage() . "<br/>";

die();

}

phpinfo();

?>

#部署wordpress

systemctl enable --now httpd mariadb

mysql

create databases woedpress;

grant all on wordpress.* to wordpress@'localhost' identified by 'xuziran';

wget https://cn.wordpress.org/latest-zh_CN.zip

tar xvf wordpress

mv wordpress/* /var/www/html/

chown -R apache.apache /var/www/html/

#搭建NFS服务nfs server10.0.0.10,

       nfs client10.0.0.7  10.0.0.6

#mkdir -pv /data/home

#useradd -d /data/home/user1 -u 2000 user1

#vim /etc/exports.d/test.exports

/data/home *(rw)

#exportfs -r

#useradd -M -u 2000 user1

/home  /etc/suto.home

#client:10.0.0.7主机

#vim /etc/auto.home

* -fstype=nfs,vers=3 10.0.0.10:/data/home/&

#systemctl restart autofs

#su - user1

#第二太client主机10.0.0.6上实现绝对路径的autofs

#luseradd -M -u 2000 user1

#vim /etc/auto.master

/- /etc/auto.home

#vim /etc/auto.home

/home/user1 -fstype=nfs,vers=4 nfsserver:/data/home/user1

#systemctl start autofs

##

 

 

 

 

 

------------恢复内容结束------------

posted @ 2020-09-16 16:34  xuziran  阅读(121)  评论(0编辑  收藏  举报