Setting up Virtual Hosting in Apache on Windows
Setting up Virtual Hosting is easier than you think. You can ignore this step if you want to develop your applications using the http://localhost notation. But in a real case scenario you would like to setup a development environment on your machine to simulate real world conditions.
This tutorial will guide you through the step by step process of how to setup virtual hosting in Apache on Windows. For this example I will be configuring http://dev.sunilb.com as the domain for development purposes. For those of you who don’t have their own domain and/or website to configure, I recommend you seeking advice from a website hosting guide
Step 1: Edit the hosts fileEdit the host file available in the Windows Root folder\system32\drivers\etc (C:\Windows or C:\Winnt – or wherever you have installed windows) .
Locate the hosts file and create a backup of that file.
Open that file. You will see some entries like:
Type in the following line:
and, save the file.
Step 2: Update Apache Configuration File
The next step involves configuring Apache to know that it needs to accept requests for http://dev.sunilb.com
Open the Apache configuration file (httpd.conf). It will be available under the conf folder of your Apache Installation (ideally the location is C:\Apache Group\Apache2\conf).
Create a backup of that file.
Paste the following code towards the end of the file and restart the Apache Server (Start > Programs > Apache HTTP Server 2.2.6 > Control Apache Server > Restart)
ServerAdmin [email protected]
*:80 instructs Apache that it should listen to all requests coming to port 80 on any IP of that machin. So the * is indeed the IP.
ServerAdmin is the email address that will get printed when a server encounters an error. The users get a message stating that Server has encountered an error and you should contact this email address
DocumentRoot tells Apache the root folder of your website
ServerName tells Apache the domain for which Apache should listen to requests
What happens when you type a domain name in your browser
When you type a domain name in the browser, the Operating System first tries to resolve the domain against the IP list mentioned in the hosts file. If it finds the IP information in that file, then it tries to connect to that IP.
If the domain information is not available in the hosts file then the domain is searched for using DNS services.
Because you want your domain to work on your local machine you need to follow the above steps.
Step 3: Validate your changes Create a file index.php in the DocumentRoot folder. Open your browser and type in the domain that you configured and index.php.
IT certifications trend is changing. Small companies owner wish to appoint a person having a variety of certification exams, so that he can manage all IT related tasks. The best combination of different IT certification exams include the IBM I Operating System 000-973, JN0-570 JNCIS-SSL, Microsoft office project 70-633, Microsoft MB2-631, Cisco 642-415 UCAD and 642-873 ARCH Designing Cisco Network Service Architectures.