Apacahe is a very unique and the most popular web server which is used by different types of websites which is also called as Apache httpd .

Below are the installation steps for Apache. The user who is familiar with changing directories, using tar and gunzip, compiling and has root account of the server can easily install Apache

Installing Apache version 1.3.37

1) SSH to your server as root & download Apache 1.3.37 source from Apache httpd server website, http://httpd.apache.org/

# cd /usr/local/src
# wget http://httpd.apache.org/download.cgi

2) Extract the tar file.

# tar -zxvf apache1.3.tar.gz
# cd apache1.3

3) Now configure the source tree. We are installing apache at /usr/local/apache. Following will create a make file.

# ./configure –prefix=/usr/local/apache \
–enable-so \
–enable-cgi \
–enable-info \
–enable-rewrite \
–enable-speling \
–enable-usertrack \
–enable-deflate \
–enable-ssl \
–enable-mime-magic

You may only enable ‘-so‘. More information regarding the other options, you can try ./configure –help

Setting up Apache server.

1) With the above installation of apache the apache conf file is created at /usr/local/apache/conf/httpd.conf

1) If you want to run Apache on a different port to the default (80) then then change the number on line 280. Ports less than 1023 will require Apache to be started as root. Port 80 is probably the easiest to use since all other ports have to be specified explicitly in the web browser, eg: http://localhost:81.

Port 80

2) You may want to change the server admin email address on line 313:

ServerAdmin admin@example.com

3) Specify your machine name on line 331, you may just have to remove the # comment marker. If you configure virtual hosts as outlined below then Apache will use the virtual server you name here as the default documents for the site.

ServerName www.example.com

4) You should set the document root on line 338:

DocumentRoot /usr/local/apache/htdocs

5) And on line 363:

This should be changed to whatever you set DocumentRoot to.

6) The default file to serve in directories is index.html. You can change this or add new file names (in order or importance) on line 414.

DirectoryIndex index.html index.htm index.php

7) If you don’t get a large number of hits and you want to know where your visitors are from then turn host name look ups on at line 511. Turning this on does place extra load on your server as it has to look up the host name corresponding to the IP address of all your visitors.

HostnameLookups On

8) Apache Errorlog on line 520:

ErrorLog /usr/local/apache/logs/error_log

Setting Up Virtual Hosts:

1) Virtual Hosts in Apache enables the single Apache server to serve different web pages for different domains. Through Virtual Hosts we can configure how Apache should handle requests to each domain.

When any site or domain is browsed in a web browser, the browser sends the hostname of the server that it is connecting to, to the web server. All the HTTP request that come to the server (on the ports it was told to listen to) are caught by Apache. It checks the host name included in the request and uses that to determine the virtual host configuration it should utilize.

2) Whena request is received by Apache, it get following details:

Hostname: The domain name (eg. hostingcomments.com)
IP address: (eg. 10.10.10.1)
Port: (eg. 80)

During Apache configuration, we should mention each IP address and port combination for which we will be specifying virtual host domains, in the configuration file. So we should add the NameVirtualHost entry in the httpd.conf file:

NameVirtualHost 10.10.10.1:80

Please make sure the ipaddress that you use is configured on your machine.

3) Each virtual host will have its own directory for the web pages to be stored. This can be anywhere that the Apache web server has permission to read. For example, on a cPanel server the web pages are located at /home/username/public_html.
Now If we set a domain hostingcomments.com on the, its VirtualHost entry will be:

NameVirtualHost 10.10.10.1:80

ServerAlias www.hostingcomments.com
ServerAdmin webmaster@hostingcomments.com
DocumentRoot /home/hosting/public_html/
ServerName tmcnetwork.bayker.com
BytesLog domlogs/hostingcomments.com-bytes_log
CustomLog /usr/local/apache/domlogs/tmcnetwork.bayker.com combined

Running Apache:

1) apachectl is the easiest way to start and stop your server manually.

# cd /usr/local/apache/bin
# ./apachectl start

2) You can also copy the file /usr/local/apache/bin/httpd to /etc/init.d/ from where your can stop & start apache.

# /etc/init.d/httpd stop
# /etc/init.d/httpd start

4) Now make Apache from the above make file.

# make

5) If make is successful & goes without any error , install Apache

# make install