Older versions of Apache had all the configuration information in a single file, such as /etc/httpd.conf. In Apache 2 on SUSE, the configuration is modularized, and there is a set of configuration files under the directory /etc/apache2/. The main configuration file /etc/apache2/httpd.conf references (and describes in comments) the other configuration files in the same directory. In each case, a directive starting with the key word Include is used to pull in the content of the subsidiary configuration files.
As with other server daemons, when you make a change in the configuration files, you must either restart or reload the server using rcapache2 restart or rcapache2 reload.
There is also an option rcapache2 configtest that allows you to check whether the syntax of the configuration files is acceptable. This is equivalent to the command apache2ctl -t or apache2ctl configtest. Running any of these commands should show output like this:
# apache2ctl configtest Syntax OK
However, if there is a problem, you will see something like the following:
# apache2ctl configtest
Syntax error on line 19 of /etc/apache2/listen.conf: Invalid command 'Listeen', perhaps misspelled or defined by a module not included in the server configuration
We have made a "typo" in listen.conf, replacing the Listen directive by Listeen.
In the Apache configuration files, a hash character (#) is used to introduce a comment, which is not read by Apache. The directives in the configuration files that start a line are often written with a capital letter, but are actually case-insensitive. However, the arguments to the directives may well be case sensitive. Lines that are too long can be continued to the next line with a backslash character (\).
Looking more closely at the configuration files, the active lines in the file /etc/apache2 /httpd.conf are mostly Include directives, including another configuration file. Exceptions to this are the global ErrorLog directive (defining where Apache should log error information) and a few other global settings including the section that denies access to the entire filesystem (important for security reasons).
The configuration file is broken down into three main sections (comments in the file show where each one starts), but most of the content in each section is provided by Include directives:
■ Global Environment: This section contains directives that affect the overall operation of the Apache web server.
■ Main Server: This section provides configuration options dedicated to the operation of the primary web site.
■ Virtual Host: Here you can apply the same configuration options available in the main server configuration section to any virtual host.
j f - - r Virtual hosts are discussed later in the chapter.
Was this article helpful?