• Home
  • About

szehau's weblog

Life, Internet, Software, Gadgets, Programming and Investments

  • life log
  • internet
  • programming
  • software
  • working holiday
  • gadget
  • project

Setup Multiple Virtual Host in Apache (Windows)

August 27, 2007 20:52 by Sze Hau 1 Comment

Recently I need to maintain multiple websites’ source code (PHP) at the same time at local host. Every time I need test another website, I need to modify the httpd.conf configuration file and restart the Apache server. After some researches on the internet, I manage to find a way to setup multiple virtual host.

  • Modify httpd.conf to add in the following code after the “LoadModule xxx” lines:
  • NameVirtualHost 127.0.0.1
    <VirtualHost 127.0.0.1>
    DocumentRoot "C:\php\site1"
    ServerName site1
    </VirtualHost>
    <VirtualHost 127.0.0.1>
    DocumentRoot "C:\php\site2"
    ServerName site2
    </VirtualHost>
  • Where “C:\php\site1” and “C:\php\site2” is the path to files for virtual host “site1” and “site2” respectively.
  • Restart Apache Httpd service.
  • Edit the file in “C:\[Windows]\System32\drivers\etc\hosts and add in the following lines:
  • 127.0.0.1 site2
    127.0.0.1 site1
  • Point your browser to “http://site1/” or “http://site2” and will be execute to both site1 and site2 code.

Hope this bookmark help you too.

More from my site

  • House: An asset or liability?House: An asset or liability?
  • Christmas Themed Ad Units On my siteChristmas Themed Ad Units On my site
  • New wordpress themeNew wordpress theme
  • iPhone 4iPhone 4
  • RON95 Petrol and Diesel up 20 Cents Today!RON95 Petrol and Diesel up 20 Cents Today!
  • Happy New Year 2014Happy New Year 2014

Filed Under: internet, programming

About Sze Hau

Geek. Love programming. Coffee addicted. Married with a child. Working towards financial freedom.

Comments

  1. Kien says

    August 28, 2007 09:34 at 9:34 am

    It’s save my time. Thanks.

    Reply

Leave a Reply to Kien Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Email News Letter

Sign up to receive updates daily and to hear what's going on with us

  • Facebook
  • Google+
  • Instagram
  • Twitter

More Posts

5 Essential Things You Need To Have At Your Home During The COVID-19 Pandemic

June 1, 2021 22:15 By Sze Hau Leave a Comment

LED Downlight

Troubleshooting A Flickering LED Downlight

February 13, 2016 00:29 By Sze Hau Leave a Comment

Repair A Broken iPhone Lightning Cable

January 30, 2016 00:54 By Sze Hau Leave a Comment

Sponsored Links

Blog Network

  • Personal Fincance Personal Finance – Personal Money Tips, Stock Investment, Small Business and Make Money Online
  • Snippet IT Information technology news, ideas and experiences and opinions

szehau’s weblog

szehau is a software programmer that has strong interest in the world of programming and Internet. He is graduated in University of Malaya, Malaysia with a Bachelor’s degree in Software Engineering. He draws on his passsion for web programming to share with others how to build a successful websites.

Recent

  • 5 Essential Things You Need To Have At Your Home During The COVID-19 Pandemic
  • Troubleshooting A Flickering LED Downlight
  • Repair A Broken iPhone Lightning Cable
  • New Gadget – MacBook Pro with Retina Display (2015)
  • One Watt LED Night Light

Search

Tags

adsense advertisement baby blog blogtal Canon EOS 400D Chinese New Year Christchurch CNY DiGi electronic Facebook FBM Flickr Flickr Uploadr Google Google Maps Google Search Results Google Webmaster Central H1N1 income tax investment joke KLCI KLSE Lake Tekapo Maxis Maybank2u Motueka movie mutual funds New Zealand PC Fair 2009 Queenstown restaurant for dinner sharing stock trackback travel Twitter unit trust visa wordpress wordpress plugin working holiday

Copyright © 2025 · Magazine Pro Theme on Genesis Framework · WordPress · Log in