Almost every website developer has Apache installed on his machine to test the code. Specifically if you are a professional web developer, and want to show a preview/current status of work to your clients, getting your http://localhost online can be of great help.
Making your localhost or local Apache Installation available over the internet will greatly minimize your efforts and time taken, assuming that currently you upload all the files to an online server via ftp, update the databases with phpMyAdmin and then tell your clients to see the work on a domain like http://sandbox.yourdomain.com/project-name/
If some of you did not clearly get what I mean by getting the localhost online, if your localhost is online, then you (or anyone on the internet) can access what you see on typing http://localhost on your computer by typing out http://your.ip.address)
So, what needs to be done?
- Firstly, you need to open up port 80 (this is the one used for http requests) on your computer. To do so, go to your firewall software (well, if you don’t have one, windows firewall must be at work. Access it from control panel)
- There, find an option for inbound rules. If you’re using windows 7 with the default windows firewall, you will find it in the left sidebar.
- Then add a new rule. On windows firewall (win 7), click on advanced settings nad select the option “Port” on the first screen
- Then on next screen, select TCP as the protocol and the specific local port to 80.
- Then simply click on a option that says allow the connection to everyone.
- You’re almost done. Set other options so that your client can have access to this port.
- Now go to this ip:port tester and click submit. (It will automatically fill the form for you)
- If it gives a positive test, i.e. “[your ip]:80 is working. (i.e. the port is open)“, your ISP does not block port 80 on your connection and you have been following the tutorial correctly till now.
- You should now be able to access your local apache installation if you type http://[your ip address] in the address bar of your browser. To test it for anyone else on the internet, go to a web proxy (hidemyass is my favorite) and do the same.
- Now, I’m sure you don’t want your clients to remember your IP address (and if you happen to have a dynamic IP, you will need to give them IP address every time). To fight this, google “free dynamic dns” and pick the one you like. (I found dnsdynamic.org fine and working)
FYI, dynamic DNS is a DNS service which keeps on updating the A record of a domain name (or a sub domain) to point to your IP address. So instead of typing your IP address everytime, you can go the free subdomain the dynamic DNS client provides and access your localhost.
Also note that it will take upto 15-20 minutes for the dynamic DNS to work properly.
- Follow the instructions as given by the dynamic DNS website. If you are using dnsdynamic, click on the “help” link to get a hang of it.
- If you wish to add some security layer to your localhost, then wait for my next post telling how to setup a password for your localhost.