0
点赞
收藏
分享

微信扫一扫

第4次作业

_LEON_ 2022-04-05 阅读 36
linux

1.安装apache服务器,并配置访问端口为9999。

安装apache

yum install httpd -y

安装apache手册

yum install httpd-manual

将Apache服务添加到 开机自启中

systemctl start httpd
systemctl enable httpd

设置永久允许http

firewall-cmd --permanent --add-service=http

防火墙重新加载策略

firewall-cmd --reload

进入默认发布的目录,并编辑默认发布文件内容

vim /var/www/html/index.html

<h1>hi<h1>

将访问端口设为9999

进入主配置目录

cd /etc/httpd/conf

修改主配置文件端口为9999

vim httpd.conf

重启httpd服务

systemctl restart httpd

如果不行则将selinux临时关闭

setenforce 0

防火墙添加9999端口号

firewall-cmd --permanent --add-port=9999/tcp

重新加载防火墙

firewall-cmd --reload

 2、添加新的默认页面sorry.html,在默认主页不能访问的情况下显示“很抱歉...该网站正在维护中
请您在4月1号之后再访问,感谢您的支持。”

1.进入主配置目录

cd /etc/httpd/conf

编辑主配置文件,将sorry.html设为新的默认页面

vim httpd.conf

<IfModule dir_module>
    DirectoryIndex index.html sorry.html
</IfModule>

进入默认发布目录添加sorry.html页面

cd /var/www/html

vim sorry.html

<h1>很抱歉...该网站正在维护中……请您在4月1号之后再访问,感谢您的支持。 </h1>

重启http服务

systemctl restart httpd

 

 3.配置三台虚拟主机,用基于端口的方式配置。

nmtui

 

将IPV4设置成手动 并手动添加三个IP

保存退出后输入 ip add 查看是否添加成功

然后一个一个ping查看是否成功

 

举报

相关推荐

Java第2次作业

第12次java作业

MySQL第11次作业

Java第11次作业

mysql第11次作业 (视图)

MySQL--第6次作业

数据库第13次作业

第一次 第4天

0 条评论