使用剧本格式 练习2: 1. servera执行: 1)安装httpd服务,---yum 2)在/var/www/html目录下新建index.html,内容为this is index.html---copy 3) 启动httpd服务---service 4)配置防火墙,放行http服务---firewalld 2. serverb执行: 1) 将本地的配置文件httpd.conf拷贝到serverb的/etc/httpd/conf下 如果serverb下httpd.conf文件存在就备份 2)修改/etc/httpd/conf/httpd.conf的权限为666 3)通过uri访问servera的首页index.html
时间: 2024-02-06 12:08:46 浏览: 30
场景:管理员需要在servera上安装httpd服务并在/var/www/html目录下新建index.html文件,然后启动httpd服务并配置防火墙放行http服务。同时,在serverb上需要将本地的httpd.conf配置文件拷贝到serverb的/etc/httpd/conf下,并将其权限修改为666。最后,通过uri访问servera的首页index.html。
剧本:
```
# servera
1. 管理员登录servera服务器
2. 执行以下命令安装httpd服务:
yum install httpd -y
3. 在/var/www/html目录下新建index.html文件,并写入以下内容:
echo "this is index.html" > /var/www/html/index.html
4. 启动httpd服务:
service httpd start
5. 配置防火墙放行http服务:
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
# serverb
1. 管理员登录serverb服务器
2. 将本地的httpd.conf配置文件拷贝到serverb的/etc/httpd/conf目录下,并备份原有文件:
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
scp /path/to/local/httpd.conf user@serverb:/etc/httpd/conf/
3. 修改httpd.conf文件权限为666:
chmod 666 /etc/httpd/conf/httpd.conf
4. 在浏览器中通过uri访问servera的首页index.html:
http://servera-ip-address/
```
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)