综合练习:请给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两人可以访问student,其他网站所有用户都能访问。
(2)访问缴费网站实现数据加密基于https访问。
光盘挂载:
[root@localhost ~]# mount /dev/sr0 /mnt/
关闭防火墙和seLinux:
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
主配置文件:
[root@localhost ~]# vim /etc/httpd/conf.d/SSL.conf
下载ssl模块:
[root@localhost ~]# yum install mod_ssl
生成私钥和根据私钥生成证书
[root@localhost ~]# cd /etc/pki/tls/private/
[root@localhost ~]# openssl genrsa -aes128 2048 > openlab.key
[root@localhost ~]# cd /etc/pki/tls/certs/
[root@localhost ~]# openssl req -utf8 -new -key openlab.key -x509 -days 365 -out openlab.crt
创建用户以及配置用户密码
[root@localhost ~]# htpasswd -c /etc/httpd/users song
New password:
Re-type new password:
Adding password for user song
[root@localhost ~]# htpasswd /etc/httpd/users tian
New password:
Re-type new password:
Adding password for user tian
[root@localhost ~]# htpasswd /etc/httpd/users zong
New password:
Re-type new password:
Adding password for user zong
创建相对目录以及配置网站内容:
[root@localhost ~]# mkdir /openlab/{student,data,money} -pv
[root@localhost ~]# echo ‘welcome to openlab!!!’ > /openlab/index.html
[root@localhost ~]# echo this is student > /openlab/student/index.html
[root@localhost ~]# echo this is data > /openlab/data/index.html
[root@localhost ~]# echo this is money > /openlab/money/index.html
重启服务:
[root@localhost ~]# systemctl restart httpd
结果显示: