Sunday, October 7, 2012

WAMP server on a LAN

Previously I posted about configuring WAMP server on a PC. Now it's time to move another step further, that is to configure the server so that anyone in the LAN can access the server. Luckily I have two PCs at home and a router between them.

So I installed the WAMP server on my desktop computer so that it can become the server in the LAN. I believe that desktop is more powerful and reliable. Now I should be able to connect to my desktop-web-server when I type the IP of the server in my browser, which is basically how the internet works. If we type an IP address it will directly generate a port 80 request on that server. But it was not happening.

I got the HTTP 404 reply, which means the access is forbidden. What does this mean? It means that my browser generates the HTTP request to the IP but I don't have permission to access the web server. I went through the 'httpd.conf' file in my web server to find out what's going on. Then I found out something similar to an Access List inside the file. So I changed it. There were entries,

Deny from all

I changed them to,

Allow from all

Then I tried requesting the IP address through my web browser again. Now I got the reply back, and it was the WAMP sever index page. So the web server can be accessed within the LAN now.

Then, I went one step further, here what i did was, instead of putting,

Allow from all

I typed,

Allow from 192.168.1.3

Note: 192.168.1.3 was my laptop's IP address.

Now only I can access the web server. :) Better security.

Thank you.

Saturday, October 6, 2012

WAMP server on a PC

This weekend I was thinking of hosting a web site. :D  To facilitate it, I needed a web server, and I did not have any clue of how to do this thing. But I've overheard people talking about this thing called an Apache server or something. So I googled Apache Server along with my need. Since Google always knows exactly what we need, it came up with all sorts of solutions.

Then I went through a few articles and got to know about the WAMP server.

WAMP = Windows, Apache. MySQL, PHP

Name it-self gave me a slight insight of it's usage. It is obviously a method to integrate Windows OS with Apache web server and is powered by both PHP for scripting and MySQL for databases.This was what I wanted. So I downloaded it to my Laptop and start experimenting on it.

From google I found out that by typing 'localhost' in my web browser I can access the web sites within my server. But in my case it was different, that is once I typed 'localhost' it directed me to some Windows Application namely IIS7. 

I read about it and understood the mechanism behind this problem. It is that whenever I type 'localhost' in my browser it starts a http request to my loop back  address. (127.x.x.x:80) Then I realized that IIS7 is listening to the port 80 on my laptop. There are two options now, one is to prevent IIS7 from listening to port 80 and the other is to change the port which Apache web server listens to.

As usual I did both. First I found out the configuration file for the Apache Web Server,  httpd.conf, and I read it to understand. It was straight forward. 

I replaced the entry 

LISTEN 80
to
LISTEN 8080.

Then I restarted the service and typed 'localhost:8080' in my web browser. It directed me to the WAMP server index page and proved that I was right.

The other way was to disable IIS7 and doing this was pretty easy.

First typed services.msc in run. Then disabled World Wide Web Publishing Service from the list. But here you don't need to change the listening port number of the 'httpd.conf'.

Either way the server is now up in my PC.

You can access it by typing 'localhost' or 'localhost:8080' according to the way you did the setup.

Thank you.