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访问。
1.下载安全模块
yum install mod_ssl
2.生成密钥
openssl req -newkey rsa -nodes -keyout ynzx.key(为文件名称和路径) -x509 -days 365 -out ynzx.crt(文件名称和路径)
密钥格式: 国家 地区 市 单位 职位 host 邮箱
Country Name (2 letter code) [XX]:86
State or Province Name (full name) []:ningxai
Locality Name (eg, city) [Default City]:yingchuan
Organization Name (eg, company) [Default Company Ltd]:openlab
Organizational Unit Name (eg, section) []:ce
Common Name (eg, your name or your server's hostname) []:localhost
Email Address []:admin
3.搭建子界面
vim /etc/httpd/conf.d/vhosts.cof
<Directory /www>
AllowOverride none
Require all granted
</Diretcory><Directory /www/student>
AllowOverride none
AuthType Basic #验证类型 basic为基本的用户和密码信息
AuthName "....66666..." #提示信息
AuthUserfile /etc/httpd/users #账号的存储地址
Require user song tian
</Directory><Directory /www/money>
AllowOverride none
Require all granted
</Directory><Directory /www/data>
AllowOverride none
Require all granted
</Directory>#在 /etc/httpd/conf.d/ssl/conf 中有模板
<Virtualhost 172.25.250.134:443>
ServerName www.ynzx.com
DocumentRoot /www/ynzx
Alias /student /www/syudent #前面的student为url传递参数的值 别名 后面为具体访问文件的位置
Alias /money /www/money
Alias /data /www/data
SSLEngine on
SSLCertificateFile /root/ynzx.crt
SSLCertificateFile /root/ynzx.key
</Virtualhost>
4.创建文件
mkdir /www/ynzx/index.html
echo 欢迎来到永宁中学 > /www/ynzx/index.htmlmkdir /www/{data,student,money}
echo 数据界面 > /www/data/index.html
echo 学生界面 > /www/student/index.html
echo 缴费界面 > /www/money/index.html
5.创建用户
htpasswd -c /etc/httpd/users tom
New password:
Re-type new password:
htpasswd /etc/httpd/users song
New password:
Re-type new password:
cat /etc/httpd/users #查看是否成功systemctl restart httpd
6.修改hosts 文件
vim /etc/hosts
172.25.250.134 www.ynzx.com
要想使用网页访问www.ynzx.com 则需要将电脑主机的hosts文件也配置 DNS解析