给openlab搭建web网站

题目要求:

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

192.168.7.132 www.openlab.com

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  keycd/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

15.浏览器尝试访问

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值