题目所示:
准备工作:
1.安装相应的服务
[root@localhost ~]# mount /dev/sr0 /mnt
[root@localhost ~]# vim /etc/yum.repos.d/base.repo
[BaseOS]
name=BaseOS
baseurl=file:///mnt/BaseOS
gpgcheck=0
[AppStream]
name=AppStream
baseurl=file:///mnt/AppStream
gpgcheck=0
[root@localhost ~]# dnf install httpd -y
[root@localhost ~]# yum install mod_ssl -y
将http设置开机自动启动并同时开启 :
[root@localhost ~]# systemctl enable httpd --now
关闭防火墙:
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
开始创建:
1.创建对应的文件
[root@localhost ~]# mkdir /A
[root@localhost ~]# mkdir /A/openlab
[root@localhost ~]# mkdir /A/openlab/student
[root@localhost ~]# mkdir /A/openlab/data
[root@localhost ~]# mkdir /B
[root@localhost ~]# mkdir /B/money
[root@localhost ~]# echo welcome to openlab > /A/openlab/index.html
[root@localhost ~]# echo student information > /A/openlab/student/index.html
[root@localhost ~]# echo jiaocai > /A/openlab/data/index.html
[root@localhost ~]# echo how much > /B/money/index.html
2.创建用户:
[root@localhost ~]# cd /etc/httpd
[root@localhost ~]# htpasswd -c users song
[root@localhost ~]# htpasswd users tian
3.启用SSL:
[root@localhost ~]# openssl req -newkey rsa:4096 -nodes -sha256 -keyout /etc/pki/tls/private/openlab.key -x509 -days 365 -out /etc/pki/tls/certs/openlab.crt
4.主配置文件:
[root@localhost ~]# vim /etc/httpd/conf.d/vhost.conf
5.在linux主机和window主机添加
Linux上
[root@localhost ~]# vim /etc/hosts
window上
C:\Windows\System32\drivers\etc
6.重启httpd服务
[root@localhost ~]# systemctl restart httpd
测试: