搭建web

基于与域名www.openlab.com可以访问网站内容为welcome to openlab!!!
编辑

 vim /etc/httpd/conf.d/b.conf
<VirtualHost 192.168.230.130:80 >
        ServerName www.openlab.com
        DocumentRoot /C
</VirtualHost>

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

在C:\Windows\System32\drivers\etc下写入

192.168.230.130 www.openlab.com

在Linux中的/etc/hosts写入

192.168.230.130 www.openlab.com

写入网站内容

 echo welcome to openlab !!! > /C/index.html

重启httpd服务

 systemctl restart httpd

在这里插入图片描述

2、给该公司创建三个子界面分别显示学生信息,教学资料,基于www.openlab.com/student网站访问学生信息
,www.openlab.com/data网站访问教学资料,www.openlab.com/money网站访问缴费网站
创建目录

mkdir student data money

写入内容并重启httpd

 echo xushengxinxi > ./student/index.html
 echo jiaoxueziliao > ./data/index.html
 echo jiaofeiwangzhan > ./money/index.html
  systemctl restart httpd

3、要求:1)学生信息网站只有song和tian两个人可以访问,其他用户不能访问

<Directory /C/student>
        AllowOverride none
        AuthType Basic
        AuthName "Pelease login"
        AuthUserFile /etc/httpd/users
        Require user song tian
</Directory>

 重启httpd服务
 systemctl restart httpd

网页结果

在这里插入图片描述
在这里插入图片描述
2) 访问缴费网站实现数据加密
使用https加密并让money只能使用https打开
创建虚拟目录money 并创建使用目录/D/money
开启认证

<VirtualHost 192.168.230.130:443 >
        ServerName www.openlab.com
        DocumentRoot /C
        Alias /money  /D/money
        SSLEngine on
        SSLCertificateFile /etc/pki/tls/certs/openlab1.crt
        SSLCertificateKeyFile /etc/pki/tls/private/openlab1.key
</VirtualHost>

生成证书

`openssl req -newkey rsa:4096 -nodes -sha256 -keyout /etc/pki/tls/private/openlab1.key -x509 -days 365 -out /etc/pki/tls/certs/openlab1.crt

重启httpd服务

 systemctl restart httpd

界面结果https协议访问
在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值