JAUHARI

Everything Is POSSIBLE

How To: Run Multiple Domains On A Local Computer

During web development, sometime you (I always) need to test with a domain name, whether inside local computer or online. This post will tell you how to run multiple domain on your local PC, without setting up a DNS server. I am using Apache 2.0.53.

Case: You want to develop a website for your-domain.com and need to test it online under certain domain name.

Solution:

[1] Create a local domain name

To differ between online and local domain, you need to create a local domain name (sub domain is okay), i.e: local.yourdomain.com

[2] Edit your hosts file

In Windows XP, the “hosts” file can be found at “C:\WINDOWS\system32\drivers\etc”. Put your local domain/subdomain there with the following order:

127.0.0.1 local.yourdomain.com

Hosts File

[3] Add a Virtual Host into your apache configuration file (httpd.conf)

<VirtualHost *:80>
ServerAdmin webmaster@local.yourdomain.com
DocumentRoot “D:\path\to\your\web_directory”
ServerName local.yourdomain.com
ErrorLog logs/local.yourdomain-error_log
CustomLog logs/local.yourdomain-access_log common
</VirtualHost>

httpd.conf

[4] Done.

Point your web browser to http://local.yourdomain.com. I have a result like this.

Result

From now on, you can run multiple domain on your local PC, without the need to install DNS server.

Questions are welcome. Just leave it here and I am ready to help you.

About The Author

Arief Fajar Nursyamsu

A blogger and now managing a SOHO company selling educational toys. I also run web development and content writing business. Blog and internet marketing as well as SEO are what I am doing a lot.

Other posts byArief Fajar Nursyamsu

Author's web sitehttp://arief.disolo.com

If you enjoyed this post, make sure you
Subscribe to my RSS feed!

1 Trackbacks & Pingbacks Trackback URI

  1. April 9, 2008 16:04

    Mengganti String Secara Masal Di Database MySQL | Arief . Di Solo . Com

2 in 3 threads. Add Comment → Trackback URI

2007-11-20 14:03:13

Comment by Arief Fajar Nursyamsu

It is great to know that this post is useful for you.
Thanks for visiting.

 
2007-11-20 10:04:17

Comment by Orang Indonesia

Finally I found here, thank you mas.

 

Respond

Name (required)
E-mail (required - never shown publicly)
URI
Subscribe to comments via email
Your Comment (smaller size | larger size)

Smileys:
:) :( :d :"> :(( \:d/ :x 8-| /:) :o :-? :-" :-w ;) [-( :)>- more »

You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

Comments links could be nofollow free.



  • Archives