红帽认证7.0【RHCE】第15题:配置web内容的访问
【题目】
在您的system1上的web服务器的DocumentRoot目录下,创建一个名为private的目录,要求如下:
- 从http://server.group8.example.com/pub/private.html文件副本到这个目录,并且重命名为index.html
- 不要对这个文件的内容做任何修改
- 从system1上,任何人都可以浏览private的内容,但是从其他系统不能访问这个目录的内容。
mkdir /var/www/html/private
mkdir /var/www/virtual/private
wget -O /var/www/html/private/index.html http://server.group8.example.com/pub/private.html
wget -O /var/www/virtual/private/index.html http://server.group8.example.com/pub/private.html
vim /etc/httpd/conf.d/web.conf
<VirtualHost *:80>
ServerName system1.group8.example.com
DocumentRoot /var/www/html
<Directory /var/www/html>
order allow,deny
allow from .group8.example.com
deny from .my133t.org
</Directory>
<Directory /var/www/html/private>
order deny,allow
deny from all
allow from 127.0.0.1 172.24.8.11
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www8.group8.example.com
DocumentRoot /var/www/virutal
<Directory /var/www/virtual>
</Directory>
<Directory /var/www/html/private>
order deny,allow
deny from all
allow from 127.0.0.1 172.24.8.11
</Directory>
</VirtualHost>
httpd -t
systemctl restart httpd