题目要求:
1.写本地仓库
注意:写好仓库后要挂载 (mount /etc/sr0/mnt)
2.装包(httpd -y 和 mod_ssl httpd -y)
3.创建对应目录,并写入内容
mkdir /www/openlab
echo welcome to openlab > /www/openlab/index.html
同理分别创建 /www/openlab/student /www/openlab/data /www/openlab/money
分别写入“This is student”;“This is data”;“This is money”
4.写配置文件(cd 到 /etc/httpd/conf.d)
vim vhosts.conf
具体写入内容如下:
5.创建用户访问的两个用户
6.添加本地域名解析
vim /etc/hosts
7.重启httpd服务
systemctl restart httpd
8.查看服务状态
systemctl status httpd
如果出现如下报错,则需在 vim /etc/httpd/conf/httpd.conf 中的空白地方写入: Servername 0.0.0.0:80
9.关闭防火墙
setenforce 0
systemctl stop firewalld
10.浏览器尝试访问
主网站:
子界面student实现指定用户访问:
子界面data界面:
11.实现访问缴费网站数据加密基于https访问
创建证书和密钥 crt key(cd到 /etc/pki/tls/certs/)
指令如下:
openssl genrsa - aes128 2048 > jiami.key
openssl req -utf8 -new -key jiami.key -x509 -days 100 -out jiami.crt
创建证书时注意一点: 服务器名称必须与证书的 Common Name 字段中设置的条⽬匹配
12.更改配置文件
vim vhosts.conf
具体添加如下:
如果您使⽤
firewalld
,在本地防⽕墙中打开端⼝
443
:
、
firewall- cmd - permanent - add- port=443/tcp
firewall- cmd - reload
13.重启服务
systemctl restart httpd
14.关闭防火墙
setenforce 0
systemctl stop firewalld