In this third part of a five-part article, you'll learn how to manage the Oracle HTTP Server (OHS) from the command line, how to monitor the OHS, and more. It is excerpted from chapter five of the book Oracle 10g Application Server Exam Guide, written by Sam Alapati (McGraw-Hill, 2006; ISBN: 0072262710).
As was mentioned previously in this chapter, you can classify OHS directives into classes or groups based on the context in which they can be used. A context indicates where in the server's configuration files a directive is considered legal. You can have directives that have either a server configuration, a virtual host, a directory, or an htaccess context. Remember that all directives are legal only in their specified contexts--if you use them in the wrong contexts, you'll get errors or the HTTP Server may even fail to start. You've learned about the key administrative and other OHS configuration directives earlier. Let's delve a little deeper into the application of the OHS configuration directives in various contexts and see how the OHS merges the directives when necessary.
The Server Configuration Context
The server configuration context applies to all directives inside the httpd.conf file unless they are part of any type of a container. Containers are arbitrary sections of the OHS that limit the scope of the OHS configuration directives--for example, to only a certain directory, file, or URL. This means that the scope of server context directives that fall within a container will be limited to the containers' sphere of influence.
If you place any OHS directive in the httpd.conf file, it will automatically apply to the entire OHS Web server. However, there may be cases in which you want certain directives to apply only to part of the server. You use OHS containers to limit the scope of the configuration directives. The most important of these containers are the <VirtualHost>, <Directory>, <DirectoryMatch>, <Files>, <FilesMatch>, <Location>, and <LocationMatch>. For example, a directive placed within the container tags <Files> and </Files> within the httpd.conf file will apply only to a certain file system. Similarly, you can limit the scope of a directive to a certain URL, by enclosing the directive within the container tags <Location> and </Location>. Containers thus help you to configure the OHS server at a decentralized level. Virtual hosting is a feature by which the OHS Web server serves multiple Web sites simultaneously. By using the <VirtualHost> container, you can limit the scope of a configuration directive to a certain Web site only.
Here are the various OHS containers, which are denoted by opening and closing tags before and after their names within the httpd.conf file. Remember that any directives that don't fall into one of these containers will apply to the entire server.
<VirtualHost> You can use the <VirtualHost> directives to serve multiple Web sites from a single server. This Virtual Host context specifies that a directive can appear inside <VirtualHost> containers in the server configuration files. The virtual host sections directives apply only to specific virtual hosts identified by a specific IP address--IP port pair. I'll explain the <VirtualHost> container in the section titled Virtual Host Context, later in this chapter.
<Directory> and <DirectoryMatch> These containers or sections contain directives applicable to particular directories.
<File> and <FileMatch> These containers or sections contain directives applicable only to certain files.
<Location> or <LocationMatch> These containers or sections contain directives applicable to particular URLs.
The various OHS container directives are examined in more detail in the following subsections. Note that the container directives always have HTML-type opening and closing tags surrounding the directives they enclose, as, for example, in <Directory>, </Directory>.
Virtual Host Context
OHS can serve multiple Web sites simultaneously, using a feature known as Virtual Hosting. If you place directives inside a <VirtualHost> container, they will apply only to requests from specific Web sites.The virtual host context specifies that a directive can appear inside <VirtualHost> containers in the server configuration files. The virtual host sections directives apply only to specific virtual hosts identified by a specific IP address--IP port pair. Virtual hosts and the use of the <VirtualHost> container are explained in more detail later in this chapter, in the section on virtual hosting.
Please check back next week for the continuation of this article.