Configuration File Basics
The following table provides the default location of the main Apache configuration file on multiple operating systems. Notice that since versions 1.3 and 2 of the server may need to coexist side by side, the
Table 1.1. The Location of httpd.conf on Different Systems
The main Apache configuration file is called httpd.conf. The location of this file varies depending on whether you are using Windows or Linux, and whether you compiled Apache from source code or used the binary provided by your distribution. Check the locations suggested in the previous table. Apache uses plain text files for configuration. The configuration files can contain directives and containers (also known as "sections"). You can place comments inside the file by placing a hash mark (#) at the beginning of a line. Comment lines will be ignored by Apache. A directive can span several lines if you end the previous line with a backslash character (\).
Directives control every aspect of the server. You can place directives inside containers, so they only apply to content served from a certain directory or location,
When an argument to a directive is a relative path, it is assumed to be relative to the server installation
|
Using Multiple Configuration Files
Include /etc/httpd/conf/perl.conf Include conf.d/*.conf Include siteconf/
It is sometimes useful to split the server configuration into multiple files. The
Include
directive allows you to include individual files, all of the files in a particular directory, or files matching a certain pattern, as shown in these examples. If a relative
This is usually done by Linux distributions that distribute Apache modules as RPMs. Each one of those packages can place its own configuration file in a specific directory, and Apache will automatically pick it up. |
Starting, Stopping, and Restarting Apache
apachectl start apachectl stop apachectl restart apachectl graceful
To start, stop, or restart Apache, you can issue any of these commands. Depending on how you installed Apache, you may need to provide an absolute
On Unix, if Apache binds to a privileged port (those between 11024), you will need root privileges to start the server.
If you make some changes to the configuration files and you want them to take effect, it is necessary to signal Apache that the configuration has changed. You can do this by stopping and starting the server, by sending a restart signal, or by performing a graceful restart. This
As an alternative to using the apachectl script, you can use the kill command directly to send signals to the parent Apache process. This is explained in detail in the "Alternate Ways of Stopping Apache" section in Chapter 2. On Windows, you can signal Apache directly using the apache.exe executable:
apache.exe -k restart apache.exe -k graceful apache.exe -k stop
You can access shortcuts to these commands in the Start menu entries that the Apache installer created. If you installed Apache as a service, you can start or stop Apache by using the service management tools in Windows as
Additionally, Apache 2.0 can place a program, Apache Monitor, in the system tray. It is a simple GUI that you can use to start and stop the server directly or as a service. It is either installed at startup or you can launch it from the Apache entry in the Start menu.
|