As a web developer, I like to work on web sites on my local machine and then give clients a link to the site which is hosted on my local machine so they can view progress. This save me A LOT of time syncing with remote servers as the client can view the dev site in real time on my computer.
The link I give to the client looks something like this: http://dev.theirdomain.com so essentially its not any weird hostname, its a very familiar and easy to remember link as it will contain their domain name.
Below you will find the steps necessary to make this magic happen.
Checklist before you start
There are a few essential pieces of stuff you need before you start setting things up.
- You need to know the ip of your local machine on your current local network (usually its something like 192.168.1.x). You should be able to find this in your network settings on your computer (for step 3).
- You need to have a dyn.com “DynDNS Pro and Host Services” account, which costs $40 a year (WELL WORTH IT if you have more than one dev site).
- You need to have your site configured inside of MAMP like dev.theirdomain.com (see step 2).
- You need to have admin access to your router in order to add a NAT rule (for step 4).
Why use dyn.com?
dyn.com offer a great little utility tool for mac and windows so that if your ip changes, then your dynamic dns hostname also gets updated automatically so you don’t need to keep logging into to update your ip.
See: https://dyn.com/updater-mac/ <—get this (very useful)
OKAY! Lets go!
Step 1
Make sure your MAMP ports are configured to port 80.
Step 2
Make sure your MAMP site has a proper dns domain name.
Step 3
Create a DNS alias over at dyn.com and make a note of the new hostname you create as you will need to create a cname record with the alias on the clients domain name.
For the sake of our exercise the host name at dyn.com is: devsites.dyndns.com.
IMPORTANT: make a note of the new dyn.com hostname as you will need it for the CNAME records on your clients domain DNS.
Step 4
Create a sub domain on your client’s dns with the hostname you created at dyn.com.
Step 4 (FINAL STEP)
Update your router so that external requests to the devsites domain are routed to your computer.
This part can be a little daunting for some as you have to dig into the advanced settings of your router.
I have a router given to me by my Spanish ISP, your might differ but for the most part a lot of the navigation will be similar.
Just make sure that you are looking for NAT and make sure you have your local IP to hand.
In Conclusion
As long as you have followed each step carefully, if your clients browses to the dev domain you have created, then they will see the development version of their web site running on your local machine.
Obviously, it goes without saying that you need to have MAMP running in order for them to view the site and your computer is connected to the internet.