The httpd.conf is the main configuration file for Apache Web Server software First thing we see are the LoadModule and AddModule lines of the configuration file. I suggest you leave these be as they are until you get lots of hands on with Apache and want to use advanced features of Apache. Everything should be included already for what you need to start your web server with lots of features.

The next directive of the httpd.conf file we come across is the ServerType. The options for this are:
  1. standalone
    • The server will run as a daemon process; the command to start the server is added to the system startup scripts. (/etc/rc.local or /etc/rc3.d/....)
  2. inetd
    • Inetd is the lesser used of the two options. For each http connection received, a new copy of the server is started from scratch; after the connection is complete, this program exits. There is a high price to pay per connection, but for security reasons, some admins prefer this option. Inetd mode is no longer recommended and does not always work properly. Avoid it if at all possible.
Standalone is the most common setting for ServerType since it is far more efficient. The server is started once, and services all subsequent connections. If you intend running Apache to serve a busy site, standalone will probably be your only option.

The next directive we come to is the Port. This, by default, is set to 80 and should be left there unless you have a daemon or process on your machine that already uses port 80. This just defines the port the machine uses to listen to for http requests.

The next directive is HostnameLookups, and the options are on and off. By default this is set to off, but I recommend turning this feature on. If this feature is on Apache will log the visiting domain name (ie., if this feature is off then Apache will log the visiting IP (ie. With this feature on and you review your TransferLog or use log representation software such as WebTrends©; you will get the domain name instead of the IP address of the visiting party.

User and Group define the user and group, respective to the operating system, that Apache will run as. This is normally defined to nobody and nobody as a security measure, because no user file on the machine will match either the username or the group of Apache.

The next directive is BindAddress. This defines a specific IP address for Apache to listen to. This is used primarily for commercial virtual hosting with sites that have control of their installation of Apache and is not necessary.

The next directive is ErrorLog. This defines the default error log file for apache and its location (respective the the ServerRoot Location) on the system. This log will contain all the error messages recorded by Apache unless defined inside the <Host> or <VirtualHost> directives.

Next, LogLevel defines they type of messages logged to the error log. Options are:
  1. debug
    • Debug-level messages
  2. info
    • Informational
  3. notice
    • Normal but significant condition.
  4. warn
    • Warning conditions
  5. error
    • Error conditions
  6. crit
    • Critical Conditions
  7. alert
    • Action must be taken immediately
  8. emerg
    • Emergencies - system is unusable
Now we find the LogFormat Directive. This defines the information and format that is stored in the CustomLog and can be used with the TransferLog directives.
The default definitions are as follows:
  • LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    • This is for a combined log
    • %h = remote host
    • %l = remote logname
    • %u = remote user
    • %t = time, in common log format
    • \" = will print " in the log file, anytime you wish to print " you must preceed it with \"
    • %r = first line of request
    • %>s = status of last request
    • %b = bytes sent, excluding http header
    • %{Referer}i = contents of the "Referer" header line
    • %{User-Agent}i = contents of the "User-Agent" header line
  • LogFormat "%h %l %u %t \"%r\" %>s %b" common
    • This is for a common log
    • %h %l %u %t \" %r %>s %b are the same as defined for combined log, but you will notice the common log leaves some of the information of the combined log out
  • LogFormat "%{Referer}i -> %U" referer
    • This is for a referer log
    • %{Referer}i is as defined in combined log
    • %U = the url path requested
  • LogFormat "%{User-agent}i" agent
    • This is for an agent log
    • %{User-agent}i is as defined above
  • Other information that can be defined in the LogFormat directive
    • %f = filename
    • %{VARIABLE}e = contents of the enviromental variable "VARIABLE"
    • %a = remote IP address
    • %p = canocial port of the server serving the request
    • %P = the process ID of the child that serviced the request
    • %T = time taken to serve the request, in seconds
    • %v = canocal ServerName of the server serving the request
Previous Page Next Page

Created by Red Dragon for Red Dragon Enterprises™.
Red Dragon Enterprises™ © Dec 2001. All rights reserved.