linux--16--week

时间:2020-06-02 18:59:36   收藏:0   阅读:83
1、使用ansible的playbook实现自动化安装httpd
-->实现ssh的key验证:
1-在主服务器上:ssh-keygen
scp -r .ssh/ 192.168.10.10:/root/
-->修改ansiblehostes:
技术图片
-->编写yml文件:
技术图片
-->运行:absible-play httpd.yml

2、建立httpd服务器,要求提供两个基于名称的虚拟主机:
(1)www.X.com,页面文件目录为/web/vhosts/x;错误日志为
/var/log/httpd/x.err,访问日志为/var/log/httpd/x.access
(2)www.Y.com,页面文件目录为/web/vhosts/y;错误日志为 /var/log/httpd/www2.err,访问日志为/var/log/httpd/y.access
(3)为两个虚拟主机建立各自的主页文件index.html,内容分别为其对应的主机名
-->安装httpd:
yum -y install httpd
mkdir -p /web/vhosts/{x,y}
启动:systemctl start httpd
-->基于不同ip实现:
ip addr add 192.168.10.104/24 broadcast 192.168.10.255 dev ens33 --添加ip地址
技术图片
-->更改配置文件:
技术图片
技术图片
-->重启服务:验证:
技术图片
-->验证日志:
技术图片
文件都创建成功;

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!