Setup a small local web server for your office with WampServer 2

WampServer is a useful and convenient tool to setup a web development environment on Windows. It’s so easy to use WampServer for a private purpose – the way that you only access your projects via localhost. However, if you have no experience, you will find it difficult to use WampServer for your local office. What below is how I setup the server for our web applications in my company and allow just my colleagues access the server, hope that it will help you in some way.

A first general look

First, let take a look at the general steps to know what you will do:

  • Give your server a static IP
  • Determine which computers can access your server

Step 1: A static IP for your server

In this post, I’ll setup a local web server, which means that there will be no internet connection from the server. If you want to setup a real web server which allows people connect from internet, consider looking at another article.

First, you have to know the Physical Address (or MAC Address) of the server. Open the Connection properties of the current network connection of the server, press details button and look for the Physical address line in the new opened window, you will find the Physical Address of the server as a string with 8 pair of characters separated by 5 hyphens. Copy or note this string in order to use it later.

Now, keep the Network Connection Details windows open and look at the line named as DHCP Enabled. If its value is No, write the IP of the server (which can be found at the line IPv4 Address) to another location to use in the next steps. Otherwise, you have to setup your router to get a static IP for the server.

To set the static IP for the server, open the browser and navigate to the address of the router (it may be 192.169.1.1 or 192.168.0.1). If you don’t know this, ask your network administrator to do this step. After logging in the router configuration page, find the page allow you to bind an IP to a client (computer) by the MAC address. Use the previous saved MAC address (Physical address) of the server to bind an static local IP. This step may vary in different routers.

In the end of this step, you have to know the IP address of the server. Review what I wrote before if you don’t.

Step 2: Allow computers allowed

In this step, you have to be sure all client computer can access to server. Open the Command Prompt and enter ipconfig /all command. If the result look like the follow figure, it is fine. Otherwise, consider another setting for your network.

C:\Users\TrungHieu>ping 192.168.0.101

Pinging 192.168.0.101 with 32 bytes of data:
Reply from 192.168.0.101: bytes=32 time<1ms TTL=64
Reply from 192.168.0.101: bytes=32 time<1ms TTL=64
Reply from 192.168.0.101: bytes=32 time<1ms TTL=64
Reply from 192.168.0.101: bytes=32 time<1ms TTL=64

Ping statistics for 192.168.0.101:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
The result of a successful “ping”

With WampServer running, click to its icon in the system tray, point to Apache, click httpd.conf to edit the httpd.conf file in your text editor. Find a line as # onlineoffline tag – don’t remove and be sure that the next lines are the same as below to allow access only from localhost:

#   onlineoffline tag - don't remove
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
    Allow from ::1
httpd.conf config to allow access only from localhost

To allow connections from more computer, insert Allow from <computer IP address> for each computer (with <computer IP address> is its address) after the Allow from ::1 line. You can also use IP address with subnet mask here for shorting your configuration.In some cases, you just want to allow your colleagues to access some web sites, not the whole server, do not insert more Allow statements. Go to the end of the httpd.conf file and insert this code:

<Directory "absolute/path/to/the/website/folder">

</Directory>
Insert Allow from <computer IP address> lines between the and tag.

Final step

Everything will work after you restart your Apache service by clicking to the Wamp system tray icon, point to Apache, Services and click Restart services. You can consider allowing Wamp to auto start and go online with the Windows or setup more secure method with the Basic Authentication. However, you will have a simple web server for your office with just above steps.

See my video to more specific

Leave a Reply

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