110 likes | 113 Views
CITA 310 Section 4. Apache Configuration. Directives and Containers. Statements in the Apache configuration file are called directives. A directive normally consists of a name followed by one or more parameters.
E N D
CITA 310 Section 4 Apache Configuration
Directives and Containers • Statements in the Apache configuration file are called directives. • A directive normally consists of a name followed by one or more parameters. • A directive can also be a container that consists of HTML-like starting and ending tags to group a set of directives.
Basic Directives • ServerRoot • Directory location of server files • DocumentRoot • Directory where the Web pages are stored • ServerName • DNS host name or IP address of server
Basic Directives • DirectoryIndex • Tells Apache to use the specified file(s) when a directory is queried • User • Shows the user name that Apache employs when someone requests a Web page
Other Directives • Listen (80 by default) • Determines the port number for the server • KeepAlive (On by default) • Indicates whether Apache should maintain a persistent connection • ServerSignature (Off by default) • Controls whether the server information is displayed as a result of Web page error
Directory Containers • <Directory> and </Directory> are used to enclose a group of directives that will apply only to the named directory and sub-directories of that directory. • Directory path is either the full path to a directory, or a wild-card string using Unix shell-style matching.
Wild-Card String • ? matches any single character. • * matches any sequences of characters. • You may also use [] character ranges. • None of the wildcards match a slash (/) character.
DirectoryMatch Containers • <DirectoryMatch> and </DirectoryMatch> are used to enclose a group of directives which will apply only to the named directory and sub-directories of that directory, the same as <Directory>. • However, it takes as an argument a regular expression.
Files Containers • <Files> and </Files> limit the scope of the enclosed directives by filename. • The directives given within this section will be applied to any object with a basename (last component of filename) matching the specified filename.
Location Containers • <Location> and </Location> limit the scope of the enclosed directives by URL. • It is recommended to use Location container to apply directives to content that lives outside the file system.
Modules • An Apache administrator can choose the functionality to include in the server by selecting a set of modules. • The LoadModule directive links in the object file and adds the module structure to the list of active modules.