sre-chan

RHCE服务---Web

网站需求:请给openlab搭建web网站

1.基于域名www.openlab.com可以访问网站内容为 welcome to openlab!!!

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

3.要求

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

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

1、安装Apache软件和mod_ssl包(专门为Apache server提供密码保护)

[root@node01 ~]# yum install httpd -y
[root@node01 ~]# yum install mod_ssl.x86_64 -y

2、关闭防火墙和selinux

[root@node01 ~]# systemctl is-active firewalld.service
unknown
[root@node01 ~]# getenforce
Disabled

3、修改虚拟主机文件

[root@node01 ~]# vim /etc/httpd/conf/httpd.conf # 参考模板文件修改

[root@node01 ~]# cat /etc/httpd/conf.d/vhost.conf
<VirtualHost 192.168.11.110:80>
        DocumentRoot /openlab
        ServerName www.openlab.com
</VirtualHost>

<Directory /openlab>
        AllowOverride none
        Require all granted
</Directory>

<Directory /openlab/student>
        AuthType basic
        AuthName "please login"
        AuthUserfile /etc/httpd/usrs
        Require user song tian
</Directory>

4、根据配置文件添加访问用户

[root@node01 ~]# htpasswd -c  /etc/httpd/users song
New password:
Re-type new password:
Adding password for user song
[root@node01 ~]# htpasswd -c  /etc/httpd/users tian
New password:
Re-type new password:

5、创建目录

[root@node01 ~]# mkdir -p /openlab/{student,data,money}
[root@node01 ~]# tree /openlab/
/openlab/
├── data
├── money
└── student

6、没有做dns,修改hosts文件

[root@node01 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.11.110 www.openlab.com

7、配置访问资源界面

[root@node01 ~]# echo welcome to openlab > /openlab/index.html
[root@node01 ~]# echo student > /openlab/student/index.html
[root@node01 ~]# echo data > /openlab/data/index.html
[root@node01 ~]# echo money > /openlab/money/index.html

8、测试

[root@node01 ~]# curl 192.168.11.110
welcome to openlab
[root@node01 ~]# curl 192.168.11.110/data
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://192.168.11.110/data/">here</a>.</p>
</body></html>

分类:

RHCE

技术点:

相关文章:

  • 2021-08-14
  • 2021-11-13
  • 2021-08-29
  • 2021-09-12
  • 2021-04-25
  • 2022-12-23
  • 2021-06-21
  • 2021-11-03
猜你喜欢
  • 2023-03-20
  • 2021-12-12
  • 2021-09-19
  • 2021-11-21
  • 2021-12-11
相关资源
相似解决方案