一月二十号练习题

综合练习:请给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两人可以访问,其他网站所有用户用能访问。 (2)访问缴费网站实现数据加密基于https访问。
挂载
在这里插入图片描述
配置yum文件
[root@localhost ~]# vim /etc/yum.repos.d/base.repo
[base]name=base
baseurl=file:///mnt
gpgcheck=0
enable=1
安装httph和ssl模块
[root@localhost ~]# yum install -y httpd
[root@localhost ~]# yum install -y mod_ssl
关闭防火墙和selinux
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0启动http服务
[root@localhost ~]# systemctl start httpd修改主配置文件
[root@localhost ~]# vim /etc/httpd/conf/httpd.confServerName 0.0.0.0:80添加证书
[root@localhost ~]# cd /etc/pki/tls/certs/
[root@localhost certs]# make haha.crt配置主配置文件[root@localhost certs]# vim /etc/httpd/conf.d/vhosts.conf
<Directory /openlab>
AllowOverride none
Require all granted

<Directory /openlab/student>
AuthType Basic
AuthName “please login:”
AuthUserfile /etc/httpd/yonghu<VirtualHost 192.168.246.132:443>
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5:!SEED:!IDEA
SSLCertificateFile /etc/pki/tls/certs/haha.crt
SSLCertificateKeyFile /etc/pki/tls/certs/haha.key
DocumentRoot /openlab/money
ServerName www.openlab.com
Alias /money /openlab/money
ErrorLog “/var/log/httpd/dummy-host2.example.com-error_log”
CustomLog “/var/log/httpd/dummy-host2.example.com-access_log” common

<VirtualHost 192.168.246.132:80>
DocumentRoot /openlab
ServerName www.openlab.com
ErrorLog “/var/log/httpd/dummy-host2.example.com-error_log”
CustomLog “/var/log/httpd/dummy-host2.example.com-access_log” common

重启http
[root@localhost certs]# systemctl restart httpd
创建目录
[root@localhost certs]#
mkdir /openlab/{student,money,date} -pvmkdir: 已创建目录 “/openlab”
mkdir: 已创建目录 “/openlab/student”
mkdir: 已创建目录 “/openlab/money”
mkdir: 已创建目录 “/openlab/date”
[root@localhost certs]# echo ‘welcome to openlab!!!’ > /openlab/index.html
[root@localhost certs]# echo xueshengxinxi > /openlab/studedt/index.html
[root@localhost certs]# echo jiaoxueziliao > /openlab/date/index.html
[root@localhost certs]# echo jiaofeiwangzhan > /openlab/money/index.html创建用户
[root@localhost ~]# htpasswd -c /etc/httpd/yonghu songNew password: Re-type new password: Adding password for user song
[root@localhost ~]# htpasswd /etc/httpd/yonghu tian
New password:
Re-type new password:
Adding password for user tian修改本地hosts文件
[root@localhost certs]# vim /etc/hosts
192.168.246.132 www.openlab.com
测试

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值