redhat8.2 静态web练习(http、https)

综合练习:请给openlab搭建web网站
网站需求:
1.基于域名www.openlab.com可以访问网站内容为 welcome to openlab!!!
2.给该公司创建三个虚拟网站目录分别显示学生信息,教学资料和缴费网站,基于www.openlab.com/student 网站访问学生信息,www.openlab.com/data网站访问教学资料
www.openlab.com/money网站访问缴费网站。
3.要求
(1)学生信息网站只有song和tian两人可以访问student,其他网站所有用户都能访问。
(2)访问缴费网站实现数据加密基于https访问。
在这里插入图片描述
光盘挂载:
[root@localhost ~]# mount /dev/sr0 /mnt/

关闭防火墙和seLinux:
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0

主配置文件:
[root@localhost ~]# vim /etc/httpd/conf.d/SSL.conf
在这里插入图片描述

下载ssl模块:
[root@localhost ~]# yum install mod_ssl

生成私钥和根据私钥生成证书
[root@localhost ~]# cd /etc/pki/tls/private/
[root@localhost ~]# openssl genrsa -aes128 2048 > openlab.key
[root@localhost ~]# cd /etc/pki/tls/certs/
[root@localhost ~]# openssl req -utf8 -new -key openlab.key -x509 -days 365 -out openlab.crt

创建用户以及配置用户密码
[root@localhost ~]# htpasswd -c /etc/httpd/users song
New password:
Re-type new password:
Adding password for user song

[root@localhost ~]# htpasswd /etc/httpd/users tian
New password:
Re-type new password:
Adding password for user tian

[root@localhost ~]# htpasswd /etc/httpd/users zong
New password:
Re-type new password:
Adding password for user zong

创建相对目录以及配置网站内容:
[root@localhost ~]# mkdir /openlab/{student,data,money} -pv
[root@localhost ~]# echo ‘welcome to openlab!!!’ > /openlab/index.html
[root@localhost ~]# echo this is student > /openlab/student/index.html
[root@localhost ~]# echo this is data > /openlab/data/index.html
[root@localhost ~]# echo this is money > /openlab/money/index.html

重启服务:
[root@localhost ~]# systemctl restart httpd

结果显示:
在这里插入图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值