How to put online your WampServer
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:http://localhost/ # or http://127.0.0.1Now you should access to your router web interface. Usually it is reachable by navigating to:
http://192.168.1.1However this may vary, depending on your router model. When in doubt, open the command prompt (
cmd
), type ipconfig
and press enter. You should see something like this:C:\>ipconfig Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : IP Address. . . . . . . . . . . . : 192.168.1.27 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.1Please 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.
Port Forwarding
In order to be reached by the world, you should tell your gateway where is your web server. All incoming request on port80
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 80
to 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.
httpd.conf
and find this row:Listen 80replace it with:
Listen <port number>for example:
Listen 8080And 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:
Private IP Private Port Type Public IP/mask Public Port 192.168.1.27 8081 TCP 0.0.0.0/0 8081 192.168.1.27 8081 UDP 0.0.0.0/0 8081Apply the changes and restart your router.
Configuring the server to be reachable by everyone
The last step! Open yourhttpd.conf
and find this line:ServerName localhost:80Change it to:
ServerName <your private IP>:80Example:
ServerName 192.168.1.27:80Just 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:
Order Deny,Allow Deny from allAllow from 127.0.0.1Change it to:
Order Allow,Deny Allow from allRestart your web server. Now just find out what’s your current public IP address and try to go to:
http://<public IP address>:<port>/i.e.:
http://13.37.223.21:8080/
No comments:
Post a Comment