1、安装Apache服务器,并配置访问端口为:9999
[root@localhost ~]# yum install httpd -y (apache软件)
[root@localhost ~]# yum install httpd-manual (apache的手册)
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl enable httpd
[root@localhost ~]# firewall-cmd --list-all (列出防火墙信息)
[root@localhost ~]# firewall-cmd --permanent --add-service=http (永久允许http)
[root@localhost ~]# firewall-cmd --reload (防火墙重新加载)
[root@localhost ~]# rpm -qa |grep httpd
[root@localhost ~]# vim /var/www/html/index.html
[root@localhost ~]# cd /etc/httpd/conf
[root@localhost conf]# ls
httpd.conf magic
[root@localhost conf]# vim httpd.conf
[root@localhost conf]# firewall-cmd --permanent add-port=9999/tcp (端口9999加入防火墙)
[root@localhost conf]# firewall-cmd --reload
[root@localhost conf]# firewall-cmd --list-all
[root@localhost conf]# systemctl restart httpd(重启httpd)
在网站输入地址:192.168.226.139:9999
2、添加新的默认页面sorry.html,在默认主页不能访问的情况下显示"很抱歉...该网站正在维护中,请您在4月1号之后再访问,感谢你的支持!"
[root@localhost ~]# cd /var/www/net/lor
[root@localhost lor]# ls
index.html
[root@localhost ~]# echo"很抱歉...该网站正在维护中,请您在4月1号之后再访问,感谢你的支持"> /var/www/net/lor/sorry.html
[root@localhost lor]# cd /etc/httpd/conf
[root@localhost conf]# ls
httpd.conf magic
[root@localhost conf]# vim httpd.conf
将index.html修改为sorry.html
[root@localhost conf]# setenforce 0
[root@localhost conf]# systemctl restart httpd
3、配置三台虚拟主机1,用基于端口的方式配置
[root@localhost ~]# nmtui
进入编辑连接,再进入ens33,将自动改为手动添加ip地址。