Turn your home computer into a server

Turn your home computer into a server

Written by Nostalgie Patrice on Sep 2nd, 2017 Views Report Post

Publishing your Website on the Internet

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.1 Now you should access to your router web interface. 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.1 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.

Port Forwarding 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 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. 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:

Listen 80 replace it with:

Listen port-number for example:

Listen 8080 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:

Private IP Private Port Type Public IP/mask Public Port 192.168.1.27 8080 TCP 0.0.0.0/0 8080 192.168.1.27 8080 UDP 0.0.0.0/0 8080 Apply the changes and restart your router.

For windows users do the following to make port forwarding

Open Control Panel >> System and Security >> Windows Firewall then click on “Advance Setting” and then select “Inbound Rules” from the left panel and then click on “Add Rule…”. Select “PORT” as an option from the list and then in the next screen select “TCP” protocol and enter port number “8080” under “Specific local port”then click on the ”Next” button and select “Allow the Connection” and then give the general name and description to this port and click Done.

Now you are done with PORT opening as well.

Next is “Restart All Services” of WAMP and access your machine in LAN or WAN.

Configuring the server to be reachable by everyone The last step! Open your httpd.conf and find this line:

ServerName localhost:80 Change it to:

ServerName ip-adress:8080 Example:

ServerName 192.168.1.27:8080
Just a quick note: you can jump over the step below. It can be done in an easier way by just clicking on the greenWampServer tray icon and choosing “Put Online”.

Also find this line:

onlineoffline tag - don't remove

Require local

Change it to:

onlineoffline tag - don't remove

Require all granted

In older versions of Apache, the line would look like:

Order Deny,Allow Deny from all Allow from 127.0.0.1
And you need to change it to:

Order Allow,Deny Allow from all
Restart your web server. Now just find out what’s your current public IP address and try to go to:

http://< ip address> :/ i.e.:

http://13.37.223.21:8080/ It should work now! … Or, at least, it worked for me.

Problems? Thoughts? As always, feel free to leave a comment.

Comments (0)