RHCE暑假二

给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.我们首先先安装httpd

        [root@localhost ~]# yum install httpd -y

2.然后进入/etc/hosts,写入192.168.6.128   www.openlab.com

3.创建目录以及文件/www/openlab/index.html

4.在上面创建好的文件下方写入welcome to openlabll !!!

5.在创建一个/etc/httpd/conf.d/openlab.conf 文件

        mkdir /etc/httpd/conf.d/openlab.conf

6.进入文件中编辑

<virtualhost 192.168.6.128:80>

servername www.openlab.com
documentroot /www/openlab
</virtualhost>
 
<directory /www/openlab>
allowoverride none
require all granted
</directory>

7.重启httpd

        [root@localhost ~]# systemctl restart httpd

8.设置setenforce

        [root@localhost ~]# setenforce 0

9.给该公司创建三个子界面,分别显示学生信息,教学资料和缴费网站

        1.创建三个目录/wwww/data,/wwww/money,/wwww/student

        2.分别在他们下面创建一个index.html的文件,并在他们里面随便写些内容

        3.进入/etc/httpd/conf.d/openlab.conf 文件中编辑

                <virtualhost 192.168.6.128:80>
                servername www.openlab.com
                documentroot /www/openlab
                alias /data /wwww/data
                alias /student /wwww/student
                alias /money /wwww/money
                </virtualhost>
 
                <directory /www/openlab>
                allowoverride none
                require all granted
                </directory>
 
                <directory /wwww>
                allowoverride none
                require all granted
                </directory>

10.重启httpd

        [root@localhost ~]# systemctl restart httpd

11.学生信息网站只有song和tian两人可以访问,其他用户不能访问,创建一个文件

        touch /etc/httpd/mima

12.创建song和tian用户,以及密码

        [root@localhost ~]# htpasswd -c /etc/httpd/mima song
        输入密码
        [root@localhost ~]# htpasswd /etc/httpd/mima tian
        输入密码

13.进入/etc/httpd/conf.d/openlab.conf 文件中编辑

        <virtualhost 192.168.6.128:80>
        servername www.openlab.com
        documentroot /www/openlab
        alias /data /wwww/data
        alias /student /wwww/student
        alias /money /wwww/money
        </virtualhost>
 
        <directory /www/openlab>
        allowoverride none
        require all granted
        </directory>
 
        <directory /wwww>
        allowoverride none
        require all granted
        </directory>
 
        <directory /wwww/student>
        authtype basic
        authname "pleaselogin:"
        authuserfile /etc/httpd/mima
        require user song tian
        </directory>

14.重启httpd

        [root@localhost ~]# systemctl restart httpd

15.在上面安装了mod_ssl的基础上,再安装一个mod_ssl

        [root@localhost ~]# yum install mod_ssl  -y

16.进入/etc/httpd/conf.d/openlab.conf 文件中编辑

        <virtualhost 192.168.6.128:80>
        servername www.openlab.com
        documentroot /www/openlab
        alias /data /wwww/data
        alias /student /wwww/student
        alias /money /wwww/money
        </virtualhost>
 
        <directory /www/openlab>
        allowoverride none
        require all granted
        </directory>
 
        <directory /wwww>
        allowoverride none
        require all granted
        </directory>
 
        <directory /wwww/student>
        authtype basic
        authname "pleaselogin:"
        authuserfile /etc/httpd/mima
        require user song tian
        </directory>
 
        <virtualhost 192.168.6.128:443>
        servername www.openlab.com
        documentroot /wwww/money
        sslengine on
        SSLCertificateFile /etc/pki/tls/certs/localhost.crt
        SSLCertificatekeyFile /etc/pki/tls/private/localhost.key
        </virtualhost>

17.重启httpd

        [root@localhost ~]# systemctl restart httpd

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值