6.2.1 Directives starting with <
This section explains the directives of block definition in the order of reference:
-
<Directory> directive, <DirectoryMatch> directive, and access control file.
-
<Files> directive and <FilesMatch> directive
-
<Location> directive
- Organization of this subsection
-
(1) <Directory directory-name>...</Directory>
(a) Contents
Specify the <Directory> directive when defining the directive for a specific directory. You can specify the name of the directory in the directory-name and specify the blocks that define directives valid only for that directory and its sub-directories.
Specify the directory name with an absolute path.
(b) Location where you can code
httpsd.conf, <VirtualHost>
(c) Specification example
<Directory /> ...1. Options None ...2. AllowOverride None ...3. </Directory> ...4. <Directory "Application-Server-installation-directory/httpsd/htdocs"> ...5. Options Indexes ...6. AllowOverride None ...7. Order allow,deny ...8. Allow from all ...9. </Directory> ...10.
-
Definition of the root directory
-
Disable all the functions
-
Prohibit all overwriting
-
End of definition
-
Definition of Application-Server-installation-directory/httpsd/htdocs directory
-
Directory index can be displayed
-
Prohibit all overwriting
-
Evaluate the Allow directive specification before the Deny directive specification
-
Permit access from all the hosts
-
End of definition
(2) <DirectoryMatch regular-expression>...</DirectoryMatch>
(a) Contents
Specify the <DirectoryMatch> directive when defining directives for a directory that satisfies the conditions described in the regular expressions. You can specify the directory name with regular expressions, and specify the blocks that define directives valid only for that directory and its sub-directories.
Specify the directory name in the regular expressions using an absolute path.
(b) Location where you can code
httpsd.conf, <VirtualHost>
(3) <Files file-name>...</Files>
(a) Contents
Specify <Files> directive when defining directives for specific files. You can specify the name of files in the file name and specify the blocks that define directives valid only for that file.
(b) Location where you can code
httpsd.conf, <VirtualHost>, <Directory>, .htaccess
(4) <FilesMatch regular-expression>...</FilesMatch>
(a) Contents
Specify the <FilesMatch> directive when defining directives for files that satisfy the condition described in the regular expressions. You can specify the file name with regular expressions and specify the blocks that define the directives valid only for that file.
(b) Location where you can code
httpsd.conf, <VirtualHost>, <Directory>, .htaccess
(5) <IfModule [!]module-name>...</IfModule>
(a) Contents
If the specified module is embedded, the directives specified in the block are enabled. If "!" (exclamation mark) is added before the module name, and if the specified module is not embedded, the directives specified in the block are enabled. There is no limit on the directives that can be specified in the block.
(b) Location where you can code
httpsd.conf, <VirtualHost>, <Directory>, .htaccess
(6) <Limit method-name [method-name ...]>...</Limit>
(a) Contents
Specify the <Limit> directive when defining the access control directives that are valid only for specific HTTP protocol methods. You can specify multiple method names.
Specifiable method names: GET, POST, PUT, DELETE, CONNECT, OPTIONS
(HEAD is included in GET)
Directives you can specify in the block:
-
Allow from
-
Deny from
-
AuthName
-
AuthType
-
AuthUserFile
-
AuthGroupFile
-
Order
-
Require
-
Satisfy
(b) Location where you can code
httpsd.conf, <VirtualHost>, <Directory>, .htaccess
(c) Specification example
<Directory /> <Limit PUT DELETE> ...1. Order deny,allow ...2. Deny from all ...3. Allow from .your_domain.com ...4. </Limit> ...5. </Directory>
-
Definitions for the PUT and the DELETE methods
-
Evaluate the specification of the Deny directive before the specification of the Allow directive
-
Deny access to the PUT and the DELETE methods from all hosts
-
Permit access to the PUT and the DELETE methods from .your_domain.com
-
End of definition
(7) <Location URL>...</Location>
(a) Contents
Specify the <Location> directive when defining the directives for the request to the locations described in the specific URL. However, you cannot specify the characters from ? (query string) onwards in the URL.
(b) Location where you can code
httpsd.conf, <VirtualHost>
(c) Specification example
<Location /server-status> ...1. SetHandler server-status ...2. Order deny,allow ...3. Deny from all ...4. Allow from .your_domain.com ...5. </Location> ...6.
-
Definition of the URL/server-status
-
Request of this directory is related to the server-status handler
-
Evaluate the specification of the Deny directive before the specification of the Allow directive
-
Deny access from all the hosts
-
Permit access from .your_domain.com
-
End of definition
(8) <LocationMatch regular-expression>...</LocationMatch>
(a) Contents
Specify the <LocationMatch> directive when defining the directives for the request to the URL that satisfies the conditions described in the regular expressions. However, you cannot specify the characters from ? (query string) onwards in the URL.
(b) Location where you can code
httpsd.conf, <VirtualHost>
(9) <VirtualHost {host-name | IP-address[:port-number]} [{host-name | IP-address[:port-number]} ...]>...</VirtualHost>
(a) Contents
Specify the <VirtualHost> directive when defining the directives for the request to the host described in host name or the IP address [:Port number].
Note that the host names corresponding to IPv6 addresses can also be specified. When specifying an IPv6 address for IP-address, enclose the IPv6 address in square brackets ([ ]).
For IP-address, you can specify an asterisk (*) that matches all IP addresses.
For a server name-based virtual host, explicitly specify its IP address.
(b) Location where you can code
httpsd.conf
(c) Specification example
<VirtualHost 172.17.40.30:80> : </VirtualHost> <VirtualHost [2001::123:4567:89ab:cdef]:80> : </VirtualHost>