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.
Apache httpd has been the most popular web server on the Internet since April 1996, and celebrated its 15th birthday as a project this February. The Apache HTTP Server ("httpd") is a project of The Apache Software Foundation.
Apache Configuration:
Following packages must be installed
Packages: httpd or apache
Configuration File: /etc/httpd/conf/httpd.conf
Default Webpage: /var/www/html/index.html
Following services takes part in this process so should be up
Services: httpd
Download and install required packages and lets move for further configuration.
Configuration:
In configuration file find the following parameters and change those to your own ones.
ServerAdmin
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
ServerName www.yourdomain.com (FQDN)
DocumentRoot Directory where your website exists
ServerRoot /etc/httpd
DirectoryIndex Path to directory where your website index page (Can use multiple entries for multiple websites)
KeepAlive off
Listen 80 (you can change the default port of apache)
Note:
If we changed the DocumentRoot then we have to change the
<Directory “/var/www/html”>
As well.
Now start apache service and we are ready to go.
# service httpd start
Multiple Websites on a single server:
Yes we can host multiple websites on a single server. This concept is known as virtual hosting. There are two types of virtual hosting.
-IP Based Virtual Hosting
-Name Based Virtual Hosting
IP Based Virtual Hosting:
We can do this by creating multiple logical interfaces in our Linux box and by assigning them different IPs. After doing this just add following lines in end of the httpd.conf
<VirtualHost yoursiteip>
ServerName yoursite.com
ServerAlias www.yoursite.com
ServerAdmin
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
DocumentRoot /path to your website
</VirtualHost>
Name Based Virtual Hosting:
This is the most popular method of doing virtual hosting in apache. just add following lines in end of the httpd.conf
<VirtualHost yoursite.com *> (you can use any port in place of *)
ServerName yoursite.com
ServerAlias www.yoursite.com
ServerAdmin
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
DocumentRoot /path to your website
</VirtualHost>