Cebu Business I.T. Incubator

Creating a Virtual Host in Windows Apache Server


Share







apacheI am using WAMP Server, an open source web server project, to do my web programming projects with PHP/MySQL .  WAMP Server because I am running  Windows OS; WAMP stands for Windows, Apache, MySQL, and PHP. It’s a software package actually installed in your computers in one click installation procedure. For Linux, we have LAMP.

Anyway, working with web projects sometimes requires you to do thorough testing before going to live testing and deployment of the web application. Now, a client may require you to have it locally tested using a virtual host, emulating the live production testing. Having Apache with my installed web server, now I can set up a virtual host to do the necessary testing of the application. Here’s how:

  1. Open your Apache’s httpd.conf file and append the follow lines:

    <VirtualHost 127.0.0.1>
    ServerAdmin your@email.com
    DocumentRoot d:/webproject/directory/goes/here
    ServerName yourdomain.local
    ErrorLog d:/wamp/logs/yourdomain.local-error_log
    TransferLog d:/wamp/logs/-access_log
    </VirtualHost>

    Click Save and close the file.

  2. Then, open hosts file located at C:\windows\system32\drivers\etc (usually for Windows). Add the following line:

    127.0.0.1    yourdomain.local

  3. Save the file and restart your Apache server to take effect.
  4. Now, open your web browser and try opening http://yourdomain.local

* Please edit the  names in to set your appropriate virtual host configuration.

You might also want to read...

  • No Related Post



Tags: , , , , ,


  • http://www.learnbehind.com/Learn/php/page/4 Jonathan

    Thanks for the post. I added this site to one of my favorates.

  • http://www.learnbehind.com/Learn/php/page/4 Jonathan

    Thanks for the post. I added this site to one of my favorates.