HomeOracle Page 3 - Understanding Directives and More with the Oracle HTTP Server
Merging Containers and Contents - Oracle
In this fourth article in a five-part series, you'll learn about block directives, virtual hosting, and more as they apply to the Oracle HTTP Server (OHS). It is excerpted from chapter five of the book Oracle 10g Application Server Exam Guide, written by Sam Alapati (McGraw-Hill, 2006; ISBN: 0072262710).
The Oracle HTTP Server merges multiple directives in a very particular order, with directories being searched from the top down, as shown here:
Directories inside (non-regular expression) directory containers and .htaccess directives are processed simultaneously. The .htaccess directories, if they are allowed, will always override the Directory container directives.
Next to be applied are the DirectoryMatch containers and the Directory containers.
Files and FilesMatch container directives are merged simultaneously next.
Location and LocationMatch directives are applied simultaneously last.
Each group is processed in the order it appears in the httpd.conf file, except for the <Directory> containers. The <Directory> containers are processed from the shortest directory component to the largest directory component. For example, OHS will process /usr/web/dir before it processes /usr/web/dir/sub_dir. If more than one <Directory> container refers to the same directory, they are processed in the order in which they appear in the httpd.conf file.
Directives inside the <VirtualHost> container are applied after the corresponding directives from the main server are applied. This allows virtual host configuration directives to override the main server configuration settings.
The following example shows how containers are merged, when all the containers are applied to a particular client request. The merging starts at 1 and ends at 5.
The following example shows that although you placed some access restrictions, given that the <Location> container is evaluated last, your access restrictions specified in the <Directory> container don't actually apply.
<Location /> Order deny,allow Allow from all </Location> # <Directory> section's directive # will be ignored since <Location> is processed after this <Directory /> Order allow,deny Allow from all Deny from hacker.example.com </Directory>
exam watch: Directives that share the same scope will be merged in the order they are found.
Note that the VirtualHost container directives are processed after the main server configuration directives. This allows the virtual host directives to take precedence over the main server directives.
The Oracle HTTP Server processes all section groups in the order in which they appear in the configuration files, with one exception. The Directory container (<Directory>) sections are processed from the shortest directory component to the longest. Here are some things to remember:
Use the <Directory> or <Files> directives to match objects at the file system level.
Use the <Location> directive to match URLs.
The <Location> container is always processed last.