Accessing WAMP From Computers on Your LAN

When developing locally, you’ll want access to your site(s) from multiple computers/devices connected to your network. It makes browser testing simple and convenient. Setting up WAMP for local area network access involves just a few configuration tweaks around IP Addresses and Apache. While tools like BrowserStack are great, nothing is better than testing on the real thing. So, let’s set it up.

While the instructions below are based on a WAMP Server, the steps generally apply to most Apache environments.

Configure Static IPs on LAN Computers

How you configure static IPs varies widely depending on your network setup. As a best practice, you’ll want to setup the static IP configuration on whatever device manages DHCP for the network — a router or server. Most routers allow you to bind static IP’s to MAC addresses. This is the approach I take. If you have a server managing DHCP, things can be more complicated.

Configuring static IPs for your network’s computers/devices at the DHCP management layer is best. However, you can configure them at the local level — provided you have proper access to each computer’s network configuration. Be aware that configuring static IPs on local machines make them prone to IP address conflicts in the future. Since the local machine is not the authority for allocating IPs on the network, its static IP address may be issued to another machine.

Regardless of the method used to setup static IPs, make sure to document each computer’s IP address. You will need them in a future step. Below are instructions for configuring a static IP on a Windows 7 machine.

  1. Right click the network icon in the system tray and choose Open Network and Sharing Center.
  2. Double click the network connection that you are using to connect to your local network.
  3. Click the Properties button on the popup.
  4. Select the TCP/IPv4 connection and click the Properties button.
  5. Open a new command prompt by clicking the start orb and typing cmd then hitting enter.
  6. In the new command prompt window type the command ipconfig and hit enter.
  7. Copy over the following values to the TCP/IPv4 configuration popup:
    • IPv4 Address
    • Subnet Mask
    • Default Gatway

    Assuming that you previously obtained an IP address automatically via DHCP, copying the values assigned to your machine is the best way to avoid problems initially. Essentially, you are telling your computer that whatever credentials your DCHP manager has assigned to your machine should remain.

    Regarding your Preferred and Alternate DNS server, I use the name servers provided by OpenDNS. You can use whatever valid name servers you want.

  8. Once you have supplied credentials to your network configuration, you can click the OK button and close all windows.

Configure Apache to Allow Connections

If you do not have virtual hosts setup, I recommend that you create a virtual host (vhost) in WAMP for each site you work on. Doing this allows you to easily configure access to sites on a vhost basis, as opposed to globally defining access for all sites. As you will see in the next step, virtual hosts also make the hosts file on remote machines cleaner, clearer and simpler.

  1. Open your Apache vhost configuration file located in C:\wamp\bin\Apache#.#.#\conf\extra\httpd-vhosts.conf, where #.#.# corresponds to the version of Apache that you are running in WAMP.
  2. Edit the Directory configuration of the vhost to allow access from the desired IP address(es).

    # johndugan.local
    <VirtualHost *:80>
        ServerAdmin john@johndugan.local
        DocumentRoot "c:/wamp/www/johndugan"
        ServerName johndugan.local
        ServerAlias www.johndugan.local
        ErrorLog "logs/johndugan.local-error.log"
        CustomLog "logs/johndugan.local-access.log" common
        <Directory "/">
            Deny from all
            Allow from
            Allow from #iPhone
            Allow from #iPad
            Allow from #Apple TV
            # Allow Web Fonts to load over BrowserSync proxy
            <IfModule mod_headers.c>
               SetEnvIfNoCase Origin "https?://(www\.)?(johndugan\.local|\d+)?$" AccessControlAllowOrigin=$0
               Header set Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin

    <Directory> and </Directory> are used to enclose a group of directives that will apply only to the named directory, sub-directories of that directory, and the files within the respective directories. Any directive that is allowed in a directory context may be used. More information

  3. Save the updated vhost configuration and restart Apache (restart WAMP).

Update The Hosts File on LAN Computers

The hosts file is the first reference in the DNS lookup process. Before your computer goes out the the Web to fetch DNS information, it will look at the hosts file. That is why you must add entries in the hosts file on each computer that you want to point to your local WAMP site(s).

To add entries to your hosts file follow the instructions below.

  1. Open the hosts configuration file located at C:\Windows\System32\drivers\etc\hosts in notepad.
  2. On a new line, add the IP address of the host machine (the machine running WAMP), followed by the ServerName for the vhost (ie: johndugan.local).
  3. Save and close the hosts file… and you’re all set!

9 thoughts on “Accessing WAMP From Computers on Your LAN”

  1. hi john 1st of all great article.. 🙂 i have a question is there any software like wamp that my whole team can use? i followed your tutorial and it works, then what i did is I shared the www folder to my network so that everyone from my network can access and edit the files.. is there any software that we can use to simplify the process? We are 5 in our office and we want to work with php apache sql simultaneously i hope you get what i mean 😀

    thanks a lot and looking forward for your answer

  2. Hi Kenji,

    Really, everyone should have their own copy of the codebase kept under version control – likely Git. Allowing multiple developers to edit files within the same directories is very dangerous.

    If your projects are relatively simple (WordPress sites and the like) and you like WAMP, then each developer should have WAMP installed on their machine. Then you’d have a shared repository so that people don’t step on each others toes.

    If you are working on more complicated web apps, then I’d recommend stepping up your game a bit and working with a tool like Vagrant ( That way, you can spend time fine tuning your config and deploy it across multiple machines.

    Do you guys currently use a version control system? If not, check out Git. Code School has a great introductory course on it – and it’s free!

    Good luck!

  3. Hi John, Thanks for article, But am still facing the problem on access localhost from another computer within the same LAN, my LAN is connected created using only switch (Desktop 5-Port 10/100Mbps switch) so I decide one of my PC to be as a Server.
    My problem is, I fail to access phpmyadmin of server am using XAMPP, So i need ur help if.

    failed solution that I have tried
    1. change in httpd.config to put Allow from all

    Please Help…);
    Sorry for my English but hopeful u catch my point.

  4. Hi Shasmoe,

    The Apache directives above are for Apache 2.2. I believe they still work in Apache 2.4, but you should have a look at the Access Control documentation:

    Also, before you have a look at those, make sure you are hitting your server from the client by doing a simple ping test, ie: ping and make sure your request aren’t timing out. If they are, then you need to update your hosts file with the proper entry as explained in the final block above.

  5. SetEnvIfNoCase Origin “https?://(www.)?(johndugan.local|$” about this line where does came from

Leave a Reply

Your email address will not be published. Required fields are marked *