RHCE作业2

综合练习:请给openlab搭建web网站
​    网站需求:
​    1.基于域名[www.openlab.com](http://www.openlab.com)可以访问网站内容为 welcome to openlab!!!
​    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网站访问缴费网站)。
​    3.要求 
​     (1)学生信息网站只有song和tian两人可以访问,其他用户不能访问。
​     (2)访问缴费网站实现数据加密基于https访问。

解答:

[root @localhost ~]# systemctl stop firewalld
[root @localhost ~]# setenforce 0
[root @localhost ~]# mount /dev/sr0 /mnt(media)
[root @localhost ~]# vim /etc/yum.repos.d/base.repo

进入vim以后写入命令:

[APPSTREAM]
name=appstreambaseurl=file:///media/AppStream/
gpgcheck=0
[BASEOS
name=baseos
baseurl=file:///media/BaseOS/
gpgcheck=0

最后':wq'保存退出。

wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==

安装yum源:

[root@localhost ~]# yum install bind-utils -y

检查安装完毕后,进入/etc/httpd/conf.d/中编写文件

<Virtualhost 192.168.171.128:80>
        DocumentRoot /www/openlab
        Servername www.openlab.com
</Virtualhost>

<Directory /www>
        AllowOverride none
        Require all granted
</Directory>


<Directory /www/openlab/student>
        AuthType Basic
        AuthName "Login...
        AuthUserfile    /etc/httpd/users
        Require user song tian
</Directory>

<Virtualhost 192.168.171.128:443>
        DocumentRoot /www/certs
        Servername www.openlab.com
        SSLEngine on
        SSLCertificateFile /etc/pki/tls/certs/lhx.crt
        SSLCertificateKeyFile /etc/pki/tls/certs/lhx.key
</Virtualhost>

保存退出:wq

[root@localhost ~]# vim /etc/httpd/conf.d/vhosts.conf
[root@localhost ~]# mkdir /www/openlab -p
[root@localhost ~]# ehco 'welcome to openlab.' > /www/openlab/index.html
[root@localhost ~]# cat /www/openlab/index.html
welcome to openlab.
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# vim /etc/hosts
[root@localhost ~]# curl http://www.openlab.com
welcome to openlab.
[root@localhost ~]# mkdir /www/openlab/date
[root@localhost ~]# ehco this is date > /www/openlab/date/index.html
[root@localhost ~]# curl http://www.openlab.com/date/
this is date
[root@localhost ~]# mkdir /www/openlab/student
[root@localhost ~]# ehco this is student > /www/openlab/student/index.htnl
[root@localhost ~]# vim /etc/hosts
[root@localhost ~]# vim /etc/httpd/conf.d/vhosts.conf
[root@localhost ~]# httpasswd -c /etc/httpd/users song
[root@localhost ~]# httpasswd -c /etc/httpd/users tian
[root@localhost ~]# cat /etc/httpd/users
song:
tian:
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# curl http://www.openlab.com/student/ -u song:密码
this is student
[root@localhost ~]# mkdir /www/certs
[root@localhost ~]# mkdir /www/certs/money
[root@localhost ~]# ehco this is money > /www/certs/money/
[root@localhost ~]# mkdir /private
[root@localhost ~]# openlab genrsa 2048 > /private/lHX.key

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值