1). Download the Apache HTTP Server from the apache official site based on the OS you use.Choose the correct OS based file.
2) Create a installation folder “apache” inside the dev folder.
c:\dev\apache – I am going to use this folder path in my further reference.
3) Now run the setup and during the setup process fill the appropriate data like-
Server Name - localhost Domain Name - localhost Port - 80 (default port)
4) Here your setup completes, apache uses *.conf (like httpd.conf) file to load the information to run the server as required.
This files resides in the conf folder inside –
In this file we can view the information provided to ensure everything is correct or in future we can change this file as the the requirement.
A little discription about the meaning of few lines that are nessarry –
This is the installed directory path. Don’t give ‘/’ at last of the path.
This contains the port at which the server will listen the request.
All the list of supported module which gets loaded at the time of server starts, for the extra feature required( defines the way your server will work).
This contains the DNS name of the server (localhost for us).
This contains the path of the index.html page which get called
by default when we will hit the domain name in the browser.
Here we can provide the other configuration file (.conf file) to also get loaded when we start the server. And many others. For the complete list of information plz refer the official site of Apache.
5) As we are going to run two project in our localhost so we need to change few of this settings as described below
In the httpd.conf file –
a) Comment the line ServerName, DocumentRoot
b) Uncomment the line which tells to include to httpd-vhost.conf
# Virtual hosts Include conf/extra/httpd-vhosts.conf
This files creates the virtual host for different domains we use.
6) Before making any changes/entry to this file open the “hosts” file resides in C:\Windows\System32\drivers\etc\hosts, if this file is not there than create one by copying from any different machine or download it.
In this file make few entry based on your project you are going to use in your local Tomcat / Jboss server. As I was running candidate and corporate so i created two entries like below –
In the place of 127.0.0.1 we can write the ip address of our machine, which is not advisable as the ip address may change.
Now back to httpd-vhosts.conf –
As we are configuring two projects in our system so make sure to enter the entry for both the projets as specified below-
NameVirtualHost *:80 DocumentRoot C:/dev/apache/htdocs/mydir ServerName mylocal
Ths first entry tells that if we hit http://mylocal/ , it will open the index.html page inside DocumentRoot(C/dev/apache/htdocs/mydir ) directory.
7) To Run and Test all the setting
start -> Programs -> Apache HTTP Server 2.2 -> Control Apache Server -> start
(Here we can do following action start, stop, restart).
Open browser, type http://mylocal/ and then press enter – This will open the index page of the our local site
If it comes congrats !!! all setting are perfect, Start working.