RHCE第二次作业--综合作业

本文详细描述了如何为openlab建立基于域名www.openlab.com的web网站,包括创建子页面展示学生信息、教学资料和缴费功能。通过Apache服务器配置,实现了不同页面的内容展示,并设置了访问权限,仅允许特定用户访问学生信息。同时,为缴费网站启用了HTTPS加密访问,确保数据传输安全。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

第二次作业

综合练习:请给openlab搭建web网站

 网站需求:

 1.基于域名[www.openlab.com](http://www.openlab.com)可以访问网站内容为 welcome to openlab!!!

  • 更改配置文件

[root@xixi ~]# vim /etc/httpd/conf.d/vhosts.conf

  • 创建openlab文件

[root@xixi ~]# mkdir /var/www/openlab

  • 把 welcome to openlab!!!  写入文件

[root@xixi ~]# echo 'welcome to openlab !!!' > /www/openlab/index.html

  • 重启hppd服务

[root@xixi ~]## systemctl restart httpd

  • 写域名解析

[root@xixi ~]# vim /etc/hosts

  • 关闭防火墙

[root@xixi ~]# setenforce 0

 2.给该公司创建三个子界面分别显示学生信息,教学资料和缴费网站,基于[www.openlab.com/student](http://www.openlab.com/student) 网站访问学生信息,[www.openlab.com/data](http://www.openlab.com/data)网站访问教学资料[www.openlab.com/money](http://www.openlab.com/money网站访问缴费网站) 。

 创建 data文件,并写入内容。

[root@xixi ~]# mkdir /www/openlab/data

[root@xixi ~]# echo this is data > /www/openlab/data/index.html  ---写入内容

[root@xixi ~]# curl http://www.openlab.com/data/  ---通过curl 访问一下

this is data

【Curl http://www.openlab.com/data  访问网页文件书写

   Curl http://www.openlab.com/data/ 访问目录文件书写,后面多了“/”】

[root@xixi ~]# mkdir /www/openlab/student

[root@xixi ~]# echo this is student > /www/openlab/student/index.htlm

更改配置文件

[root@xixi ~]# vim /etc/httpd/conf.d/vhosts.conf

重启httpd服务

[root@xixi ~]# systemctl restart httpd

 curl测试一下

[root@xixi ~]# curl -k http://www.openlab.com/student/ -u song:123

this is student

[root@xixi ~]# curl -k http://www.openlab.com/student/ -u song:123

this is student

 3.要求

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

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

添加song,tian 用户信息,指定用户名及密码

[root@xixi ~]# htpasswd -c /etc/httpd/users song

New password:

Re-type new password:

Adding password for user song

[root@xixi ~]# htpasswd /etc/httpd/users tian

New password:

Re-type new password:

Adding password for user tian

査看需要的用户是否添加

下载mod_ssl软件

[root@xixi ~]# yum install mod_ssl -y

创建certs和money目录,并给money写入内容

[root@xixi ~]# mkdir /www/certs

[root@xixi ~]# mkdir /www/certs/money

[root@xixi ~]# echo this is money > /www/certs/money/index.html

[root@xixi ~]# cat /www/certs/money/index.html

this is money

再一次重启httpd服务

[root@xixi ~]# systemctl restart httpd

制作秘钥及证书

[root@xixi ~]# mkdir /certs

[root@xixi ~]# mkdir /private

[root@xixi ~]# openssl genrsa 2048 > /private/haha.key

[root@xixi ~]# openssl req -new -key haha.key -x509 -days 365 -out /certs/haha.crt

curl测试一下

[root@xixi ~]# curl -k http://www.openlab.com/student/ -u song:123

this is student

[root@xixi ~]# curl -k http://www.openlab.com/student/ -u tian:456

this is student

[root@xixi ~]# curl -k https://www.openlab.com/money/

this is money

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值