[root@server conf]# vim /etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
132 #
133 # Possible values for the Options directive are "None", "All",
134 # or any combination of:
135 # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
136 #
137 # Note that "MultiViews" must be named *explicitly* --- "Options All"
138 # doesn't give it to you.
139 #
140 # The Options directive is both complicated and important. Please see
141 # http://httpd.apache.org/docs/2.4/mod/core.html#options
142 # for more information.
143 #
144 Options Indexes FollowSymLinks
145
146 #
147 # AllowOverride controls what directives may be placed in .htaccess files.
148 # It can be "All", "None", or any combination of the keywords:
149 # Options FileInfo AuthConfig Limit
150 #
151 AllowOverride None
152
153 #
154 # Controls who can get stuff from this server.
155 #
156 Require all granted
157 Deny from 192.168.220.0/24 #拒绝这个网段访问
158 </Directory>
[root@server conf]# curl 192.168.220.138/index.html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /index.html
on this server.</p>
</body></html>
5、通过别名访问其他目录内容
[root@server ~]# touch /usr/local/test.html
[root@server ~]# vim !$
vim /usr/local/test.html
Welcome
[root@server ~]# vim /etc/httpd/conf/httpd.conf
353 Alias /test/ "/usr/local/"
354 <Directory "/usr/local/">
355 Options Indexes FollowSymLinks #Indexes表示展示目录下内容。FollowSymLinks允许软链接。前边加“-”表示取消这个功能。
356 AllowOverride none
357 Require all granted
358 </Directory>
可以通过 http://ip/test/test.html访问。/usr/local/下的网站。