08:05 4G..5G 81
1、安装 apacheQ服务器,并配置访问端口
为:9999
安装apache
yumQ install httpd -
y #apache软件
yum install httpd -manual ##apache的手
册
systemct1 start httpd ##启动httpd
systemct1 enable httpd ##运行httpd
firewall-cmdQ--list-all ##列出防火墙
信息
firewall-cmd --permanent --add-
service=httpd #永久允许http
firewall-cmd --reload ##防火墙重新加载
设置访问端口
cd /etc/httpd/conf
vim httpd.conf
使用vim编辑器进入到httpd.conf中,找到
Listen 80,按i进入插入模式将80改成9999,
改完之后按esc退出插入模式按冒号wq保存退
出
更改完端口必须重启服务和防火墙添加端口号
重启服务:systemctl restart httpd
防火墙添加端口号:firewall-cmd --
permanent --add-port=8888/tcp
重新加载:firewall-cmd --reload
查看防火墙列表:firewall-cmd --list-all
2、添加新的默认页面sorry.html,不能访问的
情况下显示“很抱歉....该网站正在维护中,请
您在4月1号之后在访问,感谢您的支持。”
使用vim编辑器进入到httpd.conf中,找到
Directoryindex index.html,按进入插入模式
在index.html后空格加入sorry.html,改完之
后按esc退出插入模式按冒号wq保存退出
echo"很抱歉....该网站正在维护中,请您在4
月1号之后在访问,感谢您的支持。”>
404.html (将很抱歉...该网站正在维护中,请
您在4月1号之后在访问,感谢您的支持。导入
到404.html,自动创建404.html)
每次更改配置后要重启服务:systemctl
restart httpd
3、配置三台虚拟主机,用基于端口的方式配
置。
vim httpd.conf
使用vim编辑器进入到httpd.con