rhce第三次作业

   1.基于域名[www.openlab.com](http://www.openlab.com)可以访问网站内容为 welcome to openlab!!!

[root@server ~]#  cd /usr/share/nginx/html/

[root@server html]# cp index.html index.html.bak

[root@server html]# echo 'welcome to openlab' > index.html

进行测试

重启[root@server html]# systemctl restart nginx.service   

添加域名windows的C:\Windows\System32\drivers\etc\hosts

访问

浏览器中访问

http://www.openlab.com

  2.给该公司创建三个子界面分别显示学生信息,教学资料和缴费网站,基于[www.openlab.com/student](http://www.openlab.com/student) 网站访问学生信息,[www.openlab.com/data](http://www.openlab.com/data)网站访问教学资料

创建www目录

[root@server /]# mkdir www 

在www目录中创建三个子目录

[root@server www]# mkdir student data money

在三个子目录分别创建index.html

[root@server student]# touch index.html

[root@server data]# touch index.html 

[root@server money]# touch index.html 

分别给三个index.html写入

[root@server student]# echo 'Student Information ' > index.html

[root@server data]# echo 'Teaching materials ' > index.html

[root@server money]# echo 'Payment website ' > index.html

vim /etc/nginx/nginx.conf

include /etc/nginx/conf.d/*.conf;

创建虚拟主机

cd /etc/nginx/conf.d/

vim virtualhost.conf

配置文件

[root@server conf.d]# vim virtualhost.conf

测试

重启服务

[root@server conf.d]# systemctl restart nginx.service

    3.要求

​       (1)学生信息网站只有song和tian两人可以访问,其他用户不能访问。

​       (2)访问缴费网站实现数据加密基于https访问。

新建用户song与tian

编辑文件

[root@server conf.d]# vim virtualhost.conf

测试

nginx -t

重启服务

systemctl restart nginx.service

浏览器访问

   (2)访问缴费网站实现数据加密基于https访问。

创建私钥

[root@server ~]# openssl genrsa -aes128 2048 > /etc/nginx/money.key

密码:123456

制作证书

密码:123456

备份

[root@server ~]# cd /etc/nginx

[root@server nginx]# cp money.key money.key.bak

[root@server nginx]# openssl rsa -in money.key.bak -out money.key

Enter pass phrase for money.key.bak:

writing RSA key

修改配置文件

[root@server nginx]# vim /etc/nginx/conf.d/virtualhost.conf

测试

[root@server nginx]# nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

重启服务

systemctl restart nginx.service

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值