第一步关闭防火墙挂载
第二步下载软件
第三步配置Apache的配置文件
<VirtualHost 192.168.23.128:80>
ServerName www.openlab.com
DocumentRoot /var/www/html/welcome
</VirtualHost>
<VirtualHost 192.168.23.128:80>
ServerName student.openlab.com
DocumentRoot /var/www/html/student
<Directory /var/www/html/student>
Require user song tian
</Directory>
</VirtualHost>
<VirtualHost 192.168.23.128:80>
ServerName data.openlab.com
DocumentRoot /var/www/html/data
</VirtualHost>
<VirtualHost 192.168.23.128:80>
ServerName money.openlab.com
DocumentRoot /var/www/html/money
</VirtualHost>
2创建网页目录
mkdir /var/www/html/{data,student,money.welcome} -pv
写入内容
3创建用户song,tian
useradd song #创建用户
uesradd tian
passwd tian
passwd song #密码
4进行认证 在配置文件中
<Directory /var/www/html/student>
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/httpd/passwords
Require valid-user
</Directory>
5重起服务
systemctl restart httpd
https加密不会