综合练习:请给openlab搭建web网站
1.基于域名[www.openlab.com](http://www.openlab.com)可以访问网站内容为 welcome to openlab!!!
[root@localhost ~]# mount /dev/sr0 /mnt #挂载本地光盘
mount: /mnt: /dev/sr0 already mounted on /run/media/zhou2002/RHEL-8-5-0-BaseOS-x86_641.[root@localhost yum.repos.d]# cat rhel8.repo
# vim rhel8.repo
[BaseOS]
name=BaseOS
baseurl=file:///mnt/BaseOS
gpgcheck=0
enabled=1[AppStream]
name=AppStream
baseurl=file:///mnt/AppStream
gpgcheck=0
enabled=11.首先先安装httpd
[root@localhost yum.repos.d]# yum install httpd -y
[root@localhost conf.d]# mkdir /www/zuoye -p
[root@localhost conf.d]# cat zuoye.conf
<VirtualHost 192.168.187.30:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot /www/zuoye/
ServerName www.openlab.com
ErrorLog "/var/log/httpd/openlab-error_log"
CustomLog "/var/log/httpd/openlab-access_log" common
</VirtualHost>
<directory /www/zuoye>
allowoverride none
require all granted
</directory>网站内容为 welcome to openlab!!!
[root@localhost conf.d]# echo "welcome to openlab" > /www/zuoye/index.html
防火墙
[root@localhost conf.d]# getenforce '
> '
Enforcing
[root@localhost conf.d]# setenforce 0
[root@localhost conf.d]# getenforce
Permissive重启服务
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# setenforce 0
[root@localhost ~]# curl 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网站访问缴费网站)。
[root@localhost zuoye]# mkdir student data money
[root@localhost zuoye]# echo student > student/index.html[root@localhost zuoye]# echo data > ./data/index.html
[root@localhost zuoye]# echo money > ./money/index.html测试:
[root@localhost zuoye]# curl www.openlab.com/student/
student
3.要求 (1)学生信息网站只有song和tian两人可以访问,其他用户不能访问。 (2)访问缴费网站实现数据加密基于https访问
[root@localhost conf.d]# htpasswd -cb /etc/httpd/password song 123
Adding password for user song[root@localhost conf.d]# htpasswd -b /etc/httpd/password tian 123
Adding password for user tian[root@localhost conf.d]# cat /etc/httpd/password
song:$apr1$yaYW/weE$0WPXpPJT5UpVb0xNEVQnp/
tian:$apr1$jJtIEo9Z$BrTsgHg.JmcVUdRfjz86c1测试
[root@localhost conf.d]# curl www.openlab.com/student/ -u song
Enter host password for user 'song':
student
[root@localhost conf.d]#