Configuring Apache 2.0 -- Beginning - Basic Configuration Options
(Page 3 of 5 )
There are several directives which are important to configure for your server.
- Listen: The listen directive tells the server what IP address and/or port the Apache process is supposed to listen to, e.g. “Listen 127.0.0.1:80” would tell the server to listen on the loopback interface at port 80. You can configure multiple listen directives to bind the server to multiple IP addresses and ports.
- DocumentRoot: This directive tells Apache what the root directory for served documents will be. If your server is set to listen on 10.0.2.1, the directory specified in DocumentRoot is the directory that will be served when a Web browser connects to simply http://10.0.2.1/. Any sub-directories of the one specified here are automatically served out publicly. This directive might look something like “DocumentRoot /www/PubDocs.”
- ServerRoot: This directive tells Apache where to look for the basic file structure of the server itself. Generally, this should be left alone, as normally you will want this to point to the directory where you installed Apache.
- Timeout: The timeout directive determines how long the server will wait before terminating a connection that has stopped responding.
- ServerAdmin: This directive provides the email address for the server administrator. This is relatively important, as it is often used in error pages to allow users to contact the admin and let him or her know about a problem.
- ScriptAlias: This directive tells Apache where to look when someone requests a file in the /cgi-bin/ directory. An example of this directive looks like: “ScriptAlias /cgi-bin/ /www/apache/cgi-bin/.” These files are allowed to be executed by default, so you should be extra careful what files are placed in this directory.
- HostnameLookups: This directive can be set to “On” or “Off.” It tells Apache whether or not to go look up the hostnames of IP addresses it gets requests from, and place the hostname in the log file rather than the IP address. It can make your log files a bit more readable, but adds substantially to the bandwidth used by the server since it must do a host lookup for each entry it adds to the log files.
- ErrorLog: This simply tells Apache where to put the error log file.
- LogLevel: This determines what types of things get recorded in the error log file. This can be set to “EMERG”; “ALERT”; “CRIT”; “ERR”; WARNING”; “NOTICE”; “INFO”; “DEBUG”; and each of these gives respectively more info than those before it. It’s generally not a good idea to set a production server to higher than the “WARNING” level, since it has an impact on performace.
- LogFormat: This option determines the exact information placed on each logfile line when something is logged. This is important for setting up log files to be processed by other utilities, and simply for your own understanding. The syntax for this configuration line can be found here: http://httpd.apache.org/docs-2.0/mod/mod_log_config.html.
Next: Directory Setup >>
More Web Hosting How-Tos Articles
More By Michael Swanson