配置网页内容访问

Posted 落樰兂痕

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了配置网页内容访问相关的知识,希望对你有一定的参考价值。

问题:

本例要求在Web网站 http;//serverO.example.com的DocumentRoot目录下创建一个名为private的子目录,要求如下:
1. 从 http://classroom/pub/materials/private.html下载一个文件副本到这个目录,重命名为index.html
2.不要对文件index.html的内容作任何修改
3. 从 server0上,任何人都可以浏览private的内容,但是从其他系统不能访问这个目录的内容

方案: 

01.    <Directory”父目录路径">

02.                    Require all  denied     //上层目录拒绝任何房屋
03.     </Directory>

04.     <Directory "子目录1路径">05.         

                        Require all granted    //子目录1允许任何访问

06.     </Directory>
07.     <Directory "子目录2路径">

08.                   Require  ip IP或网段地址.. ..      [/子目录2允许少数客户机
09.      </Directory>

步骤:

1) 新建目录 /webroot,作为此站点新的网页文件根目录
# mkdir /webroot
# echo \'<h1>wo shi Webroot\' > /webroot/index.html

2) 修改配置文件/etc/httpd/conf.d/nsd01.conf
<VirtualHost *:80>
ServerName server0.example.com
DocumentRoot /webroot #修改网页文件根目录
</VirtualHost>

3) 追加写入 /etc/httpd/conf.d/nsd02.conf
<Directory "/webroot">
Require all granted #允许所有
</Directory>

4)SELinux安全上下文(标识,标签)
– chcon [-R] --reference=模板目录 新目录

# ls -Zd /webroot/ #查看目录标签值

# chcon -R --reference=/var/www /webroot/
# ls -Zd /webroot/

5) 重起httpd服务

 

以上是关于配置网页内容访问的主要内容,如果未能解决你的问题,请参考以下文章

Python编程学习之利用selenium分辨出可访问的网页并获取网页内容

jquery 怎么得到别的网页的内容

Nginx优化--网页压缩

数据访问(登录数据库查询内容在网页显示)

Nginx服务优化网页压缩与防盗链

怎么爬取网页的动态内容,很多都是js动态生