1、安装Apache服务器,并配置访问端口为:9999
#yum install httpd -y apache软件
#yum install httpd-manual apache手册
#systemctl start httpd
#systemctl enable httpd
#firewall-cmd –list-all 列出防火墙信息
#firewall-cmd –permanent –add-server=http 永久允许http
#firewall-cmd –reload 防火墙重新加载策略
#/var/www/html
#/var/www/html/index.html
#vim/var/www/html/index.html
#vim/etc/httpd/conf/httpd.conf/
2、添加新的默认页面sorry.html,在默认主页不能访问的情况下显示“很抱歉…该 站正在维护中,请您在4月1 后访问,感谢您的支持。”
#cd/var/www/html
#touch sorry.html
#vim sorry.html
#systemctl restart httpd
3、配置3台虚拟主机,用于端口的方式配置
(1)输入:nmtui
(2)下一步我们在配置文件中描述基于ip地址的虚拟主机,vim/etc/httpd/conf/httpd.conf,直接将我们的信息找地方写入即可
<VirtualHost 192.168.127.150>
DocumentRoot /home/www.root/150
ServerName www.linuxprobe.com
<Directory /home/www.root/150>
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
<VirtualHost 192.168.127.160>
DocumentRoot /home/wwwroot/160
ServerName bbs.linuxprobe.com
<Directory /home/wwwroot/160>
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
(3)配置完后我们要重启一下httpd服务
systemctl restart httpd
文章知识点与官方知识档案匹配,可进一步学习相关知识CS入门技能树Linux入门在线安装软件24799 人正在系统学习中
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!