要求:
请给openlab搭建web网站 网站需求:
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.基于域名[www.openlab.com](http://www.openlab.com)可以访问网站内容为 welcome to openlab!!!
(1)利用yum安装httpd
#挂载光盘到/mnt/cdrom
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
mount: /mnt: WARNING: device write-protected, mounted read-only.
yum install httpd -y
(2)然后进入/etc/hosts,写入192.168.xxx.xxx(此为主机地址) www.openlab.com
(3) 创建目录以及文件/www/openlab/index.html
在上面创建好的文件下方写入welcome to openlabll !!!
(4)更改配置文件
vim /etc/httpd/conf.d/vhosts.conf
(5)重启httpd
systemctl restart httpd
(6)设置setenforce
setenforce 0
(7)访问结果
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)data子页面 更改配置文件
vim /etc/httpd/conf.d/vshots.conf
(2)重启httpd服务
systemctl restart httpd
(3)创建/data网页根目录
mkdir /www/openlab/data
(4)编辑网页内容
echo 'this is openlab data' > /www/openlab/data/index.html
(5)结果
(6)访问缴费子页面基于https加密 下载mod_ssl 软件包
yum install mod_ssl -y
(7)生成秘钥及证书
openssl req -newkey rsa:4096 -nodes -sha256 -keyout /etc/pki/tls/private/openlab.key -x509 -days 365 -out /etc/pki/tls/certs/openlab.crt(该命令用于生成一个 RSA 密钥对,并根据生成的密钥对创建一个自签名的 X.509 证书。)
(8)更改配置文件
(9)创建网页文件根目录
mkdir /www/openlab/money
(10)编辑子网页money内容
echo 'this is openlab money' > /www/openlab/money/index.html
(11)重启httpd服务
systemctl restart httpd
(12)结果
(13)money子页面 更改配置文件
vim /etc/httpd/conf.d/vshots.conf
(14)创建用户 指定用户名及密码
htpasswd -c /etc/httpd/userfile song
New password:
Re-type new password:
Adding password for user song
htpasswd /etc/httpd/userfile tian
New password:
Re-type new password:
Adding password for user tian
(15)创建网页文件根目录
mkdir /www/openlab/student
(16)重启httpd服务
systemctl restart httpd