Kinds of Configuration FilesThere are various kinds of configuration files. Some of them are:
|Charset.conv||This file tells which character set is to be used for different languages.|
|conf.d/*.conf||It is added by other modules which are included into virtual host configuration when required.|
|default-server.conf||This file is a Global configuration file that consists of default value. However, these default values can be overwritten when required.|
|errors.conf||Specifies how Apache responds to errors.|
|listen.conf||This file binds Apache to specific IP addresses and ports.|
|httpd.conf||This is the main Apache server configuration file that contains “global settings” and “include statements”.|
|mod_*.conf||It contains modules that are installed by default.|
|mime.types||It contains MIME types that are familiar to the system.|
|ssl-global.conf and ssl.*||Both the files contain Global SSL configuration and SSL certificate data.|
|uid.conf||It states the user and group ID under which Apache runs.|
|vhosts.d/*.conf||It consists of virtual host configuration data.|
httpd.conf Configuration File
- The httpd.conf is a configuration file.
- It is used by the Apache HTTP Server.
- Apache server looks at this file for different configuration properties.
- It is stored in path : /etc/httpd/conf/httpd.conf.
- The default configuration of httpd.conf includes all types of directives and it works well for most systems.
How to edit httpd.conf file ?
- Copy the original file to some other file and create a backup. This will help you recover any mistakes while editing the file.
- If any mistakes are found in httpd.conf file, the web server will not work properly.
- To edit httpd.conf file open the file through editor like “vi editor”, so that you can make changes in it.
- After editing, reload the file or stop and start httpd process.
- To reload the server configuration file type use /service httpd reload command.
- To start the server configuration file type use /service httpd start command.
- To stop the server configuration file type use /service httpd stop command.
- To restart (stop and start) the server configuration file type use /service httpd restart command.
If web server does not work properly, then you have made some typo mistakes. Check the latest entries in the web server's error log stored at /var/log/httpd/error_log to see the errors.
Configuration Directives in httpd.confServerRoot
It specifies the top level directory containing website content. Both your secure and non-secure servers are set to ServerRoot of “/etc/httpd”.
PidFile names the file where server stores its process ID (Pid). By default, pid is listed in /var/run/httpd.pid.
It sets the path to the lockfile. It is used when httpd is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or USE_FLOCK_SERIALIZED_ACCEPT.
Timeout sets the amount of time in seconds that your server will wait for response and transmissions during communications. By default, it is set to 300 seconds,
which is appropriate for most situations.
It sets whether the server allows more than one request per connection and can be used to prevent a client from using too much of the servers resources. By default, KeepAlive is set to off that means server does not allow continuous connections.
MaxKeepAliveRequests sets the maximum number of requests allowed per persistent connections. It is set to 100 by default, which should be suitable for most situations.
This directive sets the number of seconds your server will wait for next request, after a request has been served before it closes the connection. By default, it is set to 15 seconds.
This directive sets how many server processes are created upon startup. The Web server is set to start 8 server processes at startup.
Maxclients sets a limit on the total number of server processes that can run simultaneously at one time. The main purpose of this directive is to keep a runaway web server from crashing the operating system. By default, it is set to 150.
This directive is used to load in Dynamic Shared Object (DSO) modules. The order of modules is important.
It sets the userid used by the server to answer the requests. User is not allowed to execute any code that is not intended to be in response to HTTP requests. By default, User is set to Apache.
It is similar to the User. The Group sets the groupid under which the server will answer requests. By default, Group is set to Apache.
It specifies a hostname and port number for the server. ServerName which is different from the server's real host name. ServerName must be a valid DNS (Domain Name Service).
It controls which server features are available in a particular directory. By default, it is set to 'FollowSymLinks' which means that server is allowed to follow symbolic links in the root directory.
Allow specifies which requester can access a given directory. The requester can be all, an IP address, a domain name, a partial IP address, a network/netmask pair. By default, it is set to all.
Deny is similar to Allow. It specifies which requester is denied from access. The requester can be all, an IP address, a domain name, a partial IP address, a network/netmask pair.
LogLevel can be set from least verbose to most verbose. It sets how verbose the error messages in the error logs can be.
LogFormat sets up a format for the messages in your access log.
CustomLog identifies the log file and its log file format.
This directive adds line containing the Apache server version and ServerName of the serving host to any server generated documents. The default ServerSignature is set to 'On'.
AddType directive is used to define MIME type and file extension pairs. For instance, web server identifies .php4, .php3, .phtml, .php as PHP MIME types.
This directive maps file extensions to specific handlers.
The cgi-script handler is matched with an extension .cgi for which the format is
AddHandler cgi-script .cgi
It contains a MIME content type and CGI script pair, so that if a file of that media type is requested, a particular CGI script is executed.
It sets precedence for different languages.