1.基于域名www.openlab.com可以访问网站内容为welcome to openlab!!!

(1)设置权限允许访问,写配置文件

[[email protected] ~]# vim /etc/httpd/conf.d/vhosts.conf

Linux搭建web网络练习

保存退出

(2)创建目录,写入信息

[[email protected] ~]# mkdir /www/openlab -p
[[email protected] ~]# echo 'welcome to openalab!' > /www/openlab/index.html

(3)关闭防火墙,重启服务

[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# setenforce 0
[[email protected] ~]# systemctl restart httpd
(4)在虚拟机和主机上修改配置文件

①虚拟机上修改

[[email protected] ~]# vim /etc/hosts

Linux搭建web网络练习

②主机上修改  C:\Windows\System32\drivers\etc\hosts

Linux搭建web网络练习

保存退出

(5)测试

Linux搭建web网络练习

Linux搭建web网络练习

2.给该公司创建三个虚拟网站目录分别显示学生信息,教学资料和缴费网站,基于www.openlab.com/student网站访问学生信息,www.openlab.com/data网站访问教学资料,www.openlab.com/moeny网站访问缴费网站。

(1)设置权限允许访问,写配置文件

[[email protected] ~]# vim /etc/httpd/conf.d/vhosts.conf

Linux搭建web网络练习

(2)重启服务关闭防火墙

[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# setenforce 0
[[email protected] ~]# systemctl restart httpd

(3)创建目录,写入信息

Linux搭建web网络练习

(4)测试

Linux搭建web网络练习

Linux搭建web网络练习

Linux搭建web网络练习

Linux搭建web网络练习

3.要求(1)学生信息网站只有song和tian两个人可以访问,其他网站所有用户不能访问。

①创建用户

   Linux搭建web网络练习       

③设置权限允许访问

Linux搭建web网络练习

保存退出

④测试

Linux搭建web网络练习

(2)访问缴费网站实现数据加密基于https访问。

①创建证书

[[email protected] www]# cd /etc/pki/tls/certs/

[[email protected] certs]# make openlab.crt
Linux搭建web网络练习

②搭建加密的虚拟主机

[[email protected] certs]# vim /etc/httpd/conf.d/vhosts.conf

Linux搭建web网络练习

Linux搭建web网络练习

②测试

Linux搭建web网络练习

 

 

 

 

 

 

 

 

 

 

相关文章:

  • 2021-04-03
  • 2022-12-23
  • 2021-08-27
  • 2021-08-20
  • 2021-11-15
  • 2021-09-02
  • 2021-12-12
  • 2021-06-04
猜你喜欢
  • 2021-11-22
  • 2021-09-01
  • 2021-10-25
  • 2021-09-27
  • 2021-05-31
  • 2021-11-22
  • 2021-06-09
相关资源
相似解决方案