On your Windows machine you run an Apache web server with some PHP websites in there. What if you want to show all of them to your friends, or want to be reachable by the whole Internet? This may sound quite difficult to achieve, but actually it’s fairly straightforward to put online a web server: let’s see how.
Publishing your Website on the Internet
First of all, you need to get your WAMP stack up and running on your local host. I’ll assume you already have a web application hosted on your own PC, and that is reachable by just typing this URL in the address bar:
Now you should access to your router web interface. Usually it is reachable by navigating to:
However this may vary, depending on your router model. When in doubt, open the command prompt (
ipconfig and press enter. You should see something like this:
1 2 3 4 5 6 7 8
Please take note of the IP address: that’s your private address, which uniquely identifies you in your local network. If you try it in your browser, you should be able to see the public contents of your server.
In order to be reached by the world, you should tell your gateway where is your web server. All incoming request on port
80 should be redirected to your own private IP address. Even this process may vary; it really depends on your router. By the way, this is what you basically want to do: forward every request on port
192.168.1.27 (of course you must use your own IP address). But since the router’s web server already keeps the port
80 busy, here’s what you can do:
- Move the gateway’s web interface to another port;
- Move your web server to another port.
I’ll pick the last one, since it’s usually easier to do, and the first option is not always possible. So, let’s change the port: open the
httpd.conf and find this row:
replace it with:
And restart the server. Now go to
http://localhost:8080 and check that everything went as expected.
Routing the outside web traffic to your own web server
All respectable routers have an advanced section called IP/Port Forwarding: find yours. If you don’t have this, I’m afraid you cannot be reachable by the outside.
Usually you need to add two separate entries: one for TCP and one for UDP packets. Something like this will do the work:
1 2 3
Apply the changes and restart your router.
Configuring the server to be reachable by everyone
The last step! Open your
httpd.conf and find this line:
Change it to:
Just a quick note: you can jump over the step below. It can be done in an easier way by just clicking on the green WampServer tray icon and choosing “Put Online”.
Also find this line:
Change it to:
In older versions of Apache, the line would look like:
1 2 3
And you need to change it to:
Restart your web server. Now just find out what’s your current public IP address and try to go to:
It should work now! … Or, at least, it worked for me.
Problems? Thoughts? As always, feel free to leave a comment.