How To Add A Fake Domain To Your WAMP Server

Posted on November 13, 2011 by 2 comments

I have a local area network in my home office with some Windows and one Linux computers on it.
My main computer is the main developer computer in my network. I run a WAMP server on it and some web scripts for testing and development purpose.

Let’s name my main computer to ComputerOne, and every other computers on my LAN to SubComputer.

I wanted to achieve the following: every SubComputers on my network be able to connect to ComputerOne’s WAMP Server and run scripts on ComputerOne.

But I didn’t want to change simply the localhost setting of the SubComputers to the ComputerOne’s LAN IP address (eg. localhost to localhost), because SubComputers also run own WAMP/LAMP server on their own localhost.

So I decided I add a fake domain to ComputerOne’s Apache server, so SubComputers be able to connect to ComputerOne’s WAMP Server through this fake domain.

If you want to achieve a similar system please follow me.

Okay, start it.

Resources on ComputerOne

Op System: Windows 7
Web Server: Apache (WAMP)
Text Editor: notepad
Firewall: Windows Firewall

1, Enable HTTP Port in Windows Firewall on Windows 7

In order to communicate between ComputerOne and SubComputers we need to enable the inbound connection on HTTP port in ComputerOne’s firewall.
To enable that port in Windows Firewall on Windows 7 go to Start Menu>Control Panel>Windows Firewall and select “Advanced Settings”.
In the pop-up window select “Inbound Rules” (right side) and then click “New Rule…” (left side).
Now go through the New Rule Wizard ( I show you the simplest settings).

1.1, In the “Rule Type” window select “Port” and click Next
1.2, In the “Protocol and Ports” window select “TCP” and “Specific local ports” and write “80″ to the field
1.3, In the “Action” window select “Allow the connection”
1.4, In the “Profile” window select “Private” (or you can select all)
1.5, In the “Name” window name your New Rule eg. “HTTP 80 Apache (In)” you can also add some description to your New Rule.

You are done.

Note1: please consider the above settings are basic settings. Setting up a firewall is an advanced task, so please go and read/study the firewall help file extensively.

Note 2: in the 1.4 point I selected only the “Primary” option, moreover I created a new blocking rule for the profile “Public”, so if I connect with ComputerOne to unsecured wireless networks (this is the “Public” network profile in ComputerOne), the computers on this network are not able to connect to ComputerOne’s HTTP port.
If you want, You can also create a blocking rule to the profile “Public”.
Create a New Rule, go through the New Rule Wizard again, only two settings will be different. In the 1.3 point select “Block the connection”, in the 1.4 point select “Public”, that’s all.

Note 3: you should know my LAN is behind a router. And I didn’t open port 80 in my router, so my ComputerOne’s HTTP port is not open/available from the Internet.
But if your LAN is not behind a router, with the above settings your ComputerOne’s HTTP port will be available for anybody (who knows your IP address) from the Internet.

2, Add the fake domain to the Apache config

First, choose a fake domain. I picked “homeserver.home”, but you can select any domain name and extension (or you can drop the domain extension completely eg. “homeserver”).

In ComputerOne open file (use a text editor) “httpd.conf” in folder C:\wamp\bin\apache\Apache2.2.21\conf and find these lines:

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

Uncomment the second line by removing the symbol # as shown below:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Save it.

Now open file (use a text editor) “httpd-vhosts.conf” in folder C:\wamp\bin\apache\Apache2.2.21\conf\extra.
Delete all lines and add these lines to the file:

NameVirtualHost *:80

ServerName localhost
DocumentRoot C:/wamp/www

ServerName homeserver.home
DocumentRoot C:/wamp/www

Save it.

Note: the name of the folder “Apache2.2.21″ is depend on your WAMP server version.

3, Add the fake domain to the hosts files

On ComputerOne open file (use a text editor) “hosts” in folder C:/Windows/System32/drivers/etc and add this line to the file: homeserver.home

Save it.

Now find your ComputerOne’s LAN IP address:

Open a command prompt (Windows 7 – Start Menu>All Programs>Accessories>Command Prompt), type:


and press enter.

I got the following info:

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::16d:c1cd:8ce2:861a%19
IPv4 Address. . . . . . . . . . . :
Subnet Mask . . . . . . . . . . . :
Default Gateway . . . . . . . . . :

In my case ComputerOne’s LAN IP address is

Now go to your all Windows SubComputers, open file (use a text editor) “hosts” in folder C:/Windows/System32/drivers/etc and add this line to the file: homeserver.home

Save it.

Note: change to your ComputerOne’s LAN IP address.

If you have any Linux computer, add the line homeserver.home to your Linux distro’s hosts file.

In Debian add the line to /etc/hosts.

5, Restart Apache/WAMP

Now restart Apache or the whole WAMP server on ComputerOne so your new settings take effect.

That’s all.

Go to your computers on your LAN and browse to your fake domain (homeserver.home) in your browser. If everything is OK you will find your WAMP Server’s panel.

Note: If you use other Apache/PHP/MySQL package(eg. EasyPHP, XAMPP) or a standalone Apache installation on ComputerOne you can follow the above steps, but you should find the corresponding Apache conf files in other folders.

Tags: , , , ,

2 Responses to “How To Add A Fake Domain To Your WAMP Server”

  1. Chester Winner Mar 27, 2012 #

    Otimo tutorial. Estou precisando fazer algo bem parecido com isso mesmo.
    Só que está dando erro quando quero salvar o arquivo hosts. Com o bloco de notas ele não permite gravar no locao, mesmo eu sendo administrador. E com outro edito (NotePad) ele pede pra verificar se o arquivo não está aberto por outro programa.

  2. Samba Oct 07, 2013 #

    Your post was super cool…but I created my wordpress in a root folder /abcd.

    So what are the changes to the instructiond to configure it properly…


by Transposh - translation plugin for wordpress


Visitor Map

Recent Readers