第三次作业-第四章网站搭建
网站需求:
1.基于域名www.openlab.com可以访问网站内容为 welcome to openlab!!!
环境准备
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# dnf install nginx -y
vim /etc/nginx/conf.d/alias.conf

编写配置文件静态映射主机名和 IP 地址
[root@localhost ~]# vim /etc/hosts

创建目录并添加内容
访问网站

2.给该公司创建三个子界面分别显示学生信息,教学资料和缴费网站,基于www.openlab.com/student 网站访问学生信息,www.openlab.com/data网站访问教学资料
www.openlab.com/money网站访问缴费网站。
[root@localhost ~]# vim /etc/nginx/conf.d/alias.conf

创建目录

检验
3.要求 (1)访问该网站http请求都通过https响应。
[root@localhost ~]# mkdir /etc/pki/nginx
[root@localhost ~]# openssl genrsa 2048 > /etc/pki/nginx/openlab.key
[root@localhost ~]# openssl req -utf8 -new -key /etc/pki/nginx/openlab.key -x509 -days 365 -out /etc/pki/nginx/openlab.crt

(2)学生信息网站只有song和tian两人可以访问,其他用户不能访问。
vim /etc/nginx/conf.d/alias.conf

[root@localhost ~]# htpasswd -c /etc/nginx/userfile song
[root@localhost ~]# htpasswd -c /etc/nginx/userfile tian



