What is Apache Web Server?
The Apache HTTP Server referred to simply as Apache, is a web server notable for playing a main role in the initial growth of the World Wide Web. Apache was the first viable alternative to the Netscape Communications Corporation web server (currently known as Sun Java System Web Server), and has since evolved to rival other Unix-based web servers in terms of functionality and performance. The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.Netcraft Web Server Survey found that more than 70% of the web sites on the Internet are using Apache, thus making it more widely used than all other web servers combined.
Development of the Apache Web server is performed by a group of about 20 volunteer programmers, called as Apache Group. However, because the source code is freely available, anyone can adopt the server for specific needs, and there is a large public library of Apache add-ons. In many respects, development of Apache is similar to development of the Linux operating system.The original version of Apache was written for UNIX, but there are now versions that run under OS/2, Windows and other platforms.
How to Setup Apache as Web Server ?
For setup follow these steps:-
The Web server is made for keeping Websites. There are three ways a Website can be stored. They are:
a) default directory hosting
b) virtual directory hosting
c) virtual domain hosting
First We have to configure the DNS. Then configure the following file (redhat 6.2) /etc/httpd/conf/httpd.conf If we use Apache as a Web server whether on Windows platform or Linux, the main file which is used is called /etc/httpd/conf/httpd.conf
The root directory of Web server is /etc/httpd, which is divided into three parts:
1) /etc/httpd/conf (where configuration files stays)
2) /etc/httpd/logs (where the logs of Web server and site accessing stay)
3) /etc/httpd/modules (where the module stays, which enables the server side programmer to do programming in the languages supported by Web server)
Lets open the file /etc/httpd/conf/httpd.conf and take a detailed look at the macros to be used.
httpd.conf-Apache HTTP server configuration file :
This is the main Apache server configuration file. It contains the configuration directives that give the server its instructions.
After this (httpd.conf) file is processed, the server will look for and process (only in the case of 6.1 the following mentioned file is checked. If it is 6.2 they are not checked):
unless you have overridden these with ResourceConfig and/or AccessConfig directives here.
The config directives are grouped into three basic sections:
1. Directives that control the operation of the Apache server process as a whole (the ‘global environment’).
2. Directives that define the parameters of the `main’ or `default’ server, which responds to requests that aren’t handled by a virtual host. These directives also provide default values for the settings of all virtual hosts.
3. Settings for virtual hosts, which allow Web requests to be sent to different IP addresses or hostnames and have them handled by the same Apache server process.
First Section : Global Environment
The directives in this section affect the overall operation of Apache, such as the number of concurrent requests it can handle or where it can find its config files.
ServerType: ServerType is either inetd, or standalone. Inetd mode is only supported on Unix platforms.
ServerRoot: The top of the directory tree under which the server’s configuration, error, and log files are kept.
NOTE: Do not add a slash at the end of the directory path.4
LockFile: The LockFile directive sets the path to the lockfile used when Apache is compiled with either
This directive should normally be left at its default value. The main reason for changing it is if the logs directory is NFS mounted, since the lockfile must be stored on a local disk. The PID of the main server process is automatically appended to the filename.
PidFile: The file in which the server should record its process identification number when it starts.
ScoreBoardFile: File used to store internal server process information. Not all architectures require this. But if yours does (you’ll know because this file will be created when you run Apache) then you must ensure that no two invocations of Apache share the same scoreboard file.
In the standard configuration, the server will process this file, srm.conf, and access.conf in that order. The latter two files are now distributed empty, as it is recommended that all directives be kept in a single file for simplicity. The commented-out values below are the built-in defaults. You can have the server ignore these files altogether by using “/dev/null” (for Unix) or “nul” (for Win32) for the arguments to the directives.
Timeout: The number of seconds before receives and sends time out.
KeepAlive: Whether or not to allow persistent connections (more than one request per connection). Set to “Off” to deactivate. But we keep it :
MaxKeepAliveRequests: The maximum number of requests to be allowed during a persistent connection. Set to 0 to allow an unlimited amount. We recommend you leave this number high, for maximum performance.
KeepAliveTimeout: Number of seconds to wait for the next request from the same client on the same connection.
Server-pool size regulation: Rather than making you guess how many server processes you need, Apache dynamically adapts to the load it sees — that is, it tries to maintain enough server processes to handle the current load, plus a few spare servers to handle transient load spikes (e.g, multiple simultaneous requests from a single Netscape browser).
It does this by periodically checking how many servers are waiting for a request. If there are fewer than MinSpareServers, it creates a new spare. If there are more than MaxSpareServers, some of the spares die off. The default values are probably OK for most sites.
Number of servers to start initially should be a reasonable ballpark figure.
Limit on total number of servers running: Limit on the number of clients who can simultaneously connect. If this limit is ever reached, clients will be `locked out’, so it should not be set too low. It is intended, mainly, as a brake to keep a runaway server from taking the system with it as it spirals down.
MaxRequestsPerChild: The number of requests each child process is allowed to process before the child dies. The child will exit so as to avoid problems after prolonged use when Apache (and maybe the libraries it uses) leak memory or other resources. On most systems, this isn’t really needed, but a few (such as Solaris) do have notable leaks in the libraries. For these platforms, set to something like 10000 or so; a setting of 0 means unlimited.
NOTE: This value does not include keepalive requests after the initial request per connection. For example, if a child process handles an initial request and 10 subsequent “keptalive” requests, it would only count as 1 request towards this limit.
Listen: Allows you to bind Apache to specific IP addresses and/or ports, in addition to the default. See also the directive.
BindAddress: You can support virtual hosts with this option. This directive is used to tell the server which IP address to listen to. It can either contain “*”, an IP address, or a fully qualified Internet domain name.