So, still fuming about the .Mac annual fee? The question of whether .Mac is worth $100 is a personal matter, but one of the greatest ironies of this situation is that Mac OS X is packed full of features that make many aspects of .Mac unnecessary.
How about running your own unlimited version of iDisk or hosting your own Web site? And what if you can do it easily for less than a one-time fee of $50? If you aren't too keen on ponying up $100 per year for .Mac, you should at least send Apple a "Thank You" iCard for giving us Mac OS X.
What continues to amaze me are the constant surprises I find in good ole version 10.1. Every day I discover how much value is packed into Mac OS X compared to what I paid.
In a brief series of articles, I'm going to show you how to get more value out of your computer through ideas you may have never considered before. I think you might be surprised at what you can do for $100. In this article I'll show you the beginning steps of building your own version of .Mac.
For me, one of the most exciting aspects of switching to Mac OS X was the prospect of having an Apache Web server (built into the OS) at my fingertips. I've worked at many a dot-bomb that utilized the power of Unix, but never had any hands-on experience with it. In the past, the idea of running my own personal Apache Web server was ridiculous. I never considered it because of the cost and complexity, but when I first fired up Web Sharing I thought, "Sweeeeet!" While researching this issue for some of the writing I did for Mac OS X: The Missing Manual by David Pogue, I set out to answer a few questions:
The answer to all of these questions is yes. You can host your own Web site at home, you can transfer files back and forth, you could set up a private radio station, host your own database, post iPhoto pages, and if you already have a pretty fast Internet connection, you can do it for practically nothing. This article will help you get your feet wet setting up your own personal Web server. I promise that anyone can pull this off, and in the future we'll explore many of the uses for this.
First, let's take a peek at what I had to work with. A picture of my technology at home looks like this:
My wife used to use Yahoo Web hosting for her art-business Web site ($15 per month). She does her own design work, but she would have me maintain the site. Her grandmother once told her "If you don't learn to do it, you don't have to do it." Because of this philosophy, I decided to turn her computer into a Web server. I built the Web server right there on her Classic iMac, so when she saves her HTML to her hard drive, her site is automatically updated. So
I'm also able to host her FileMaker catalogue database and connect it to her Web site via XML. Now when she updates a record, the Web site will reflect the changes instantly. In addition, with a FileMaker plug-in called eAuthorize (www.wmotion.com) I could also, in theory, process credit cards (still testing this, but I will let you know how it works out). But the best part of all is I save myself $180 per year in hosting (cha-ching).
Although it took me about a week to set up my Web server the first time, you can probably set up most of your Web server in just a few hours (some registration items take a little longer). Now I want to point out that this solution is not initially intended for those who are looking to run a high-traffic site. If this is your interest, in a later article, we'll look into a solution based on Mac OS X Server.
What you will need:
If you are one of the lucky who have a DSL/Cable connection, you probably have these basics at home already. This means your initial investment is $0.
Tip: If you use a spare laptop for your home server, you can probably keep it running for at least two hours if the power fails. Try that with a $100 UPS. Of course, the router/hub poses another problem.
You need to have a computer in the house to use as your Web server. You can use any Mac OS X-enabled computer, and it doesn't require a top-of-the-line G4. If you don't want to use your current home computer as a server, you can purchase a Classic iMac on eBay for about $400 (add $50 for RAM). However, this isn't necessary. We've been running my wife's machine as a server for many months and it hasn't affected her ability to work. I do recommend you have at least 256MB or more of RAM in your machine.
You can use Airport or Ethernet to connect to your server (Ethernet is faster), or, as in my case, you can use both.
I use Airport for my internal network, my basic Firewall, printer connection, and Internet access on my laptops. On my wife's machine I have both the Ethernet port and an Airport card connected. Her Apache Web server is directly connected to the DSL through the Ethernet cable/hub, while all her printing and local network access goes though the Airport connection on my private LAN.
Thanks to Apple's multihoming and Airport, I can run both network connections simultaneously. I do this simply by enabling and adjusting the order on the Active Network Ports list (Network Preferences Pane). If you use this setup, be sure to place Ethernet at the top of the list. Now, all requests for the Web server go through the Ethernet port while Mac OS X knows where to look for the network printer on the LAN. You don't need this type of setup, but it is just so freakin' cool!
Although you may have signed up for a certain DSL speed, it is a good idea to check your actual speed. Find out from your provider what the speed of your upstream and downstream connections are suppose to be, then test those numbers with one of the bandwidth testers on the Web. I use a couple of different services so I can compare the results. There aren't many that test upstream, but you can try http://www.dslreports.com/stest.
If your speed is significantly less than what you signed up for, you have a problem somewhere. You should check with your service provider to help pinpoint the trouble. I've found that my Airport connection is typically 100k slower than Ethernet.
This is the crux of having your own Web server. Whether you are on a local Intranet or on the Internet, an IP address is how people locate your computer. I'm not going to go into a lot of detail here, but when you register a domain name, you are required to point that domain to a name server and that name server has an IP address.
The problem is that most DSL/Cable companies give you a fat connection, but they don't include a static (non-changing) IP address. They usually assign you a dynamic IP address that might change hourly, daily, or whatever. The problem is that you can't point a domain name or locate your computer on the Internet if the IP address is always changing. It's like having your computer in the witness-relocation program. Luckily, there is a solution.
Your first option is getting a static IP address from your DSL/Cable provider. My DSL provider wants to charge me an additional $10 per month for that service, but I'm trying to cut down my costs, not increase them.
Traffic on the Internet is simply routed from one IP address to another. No one can remember to type 220.127.116.11 when they want something like Yahoo, so someone created a way of locating machines called DNS. When you type in www.oreillynet.com, DNS servers are able to resolve the proper IP address associated with it and take you to that location.
There are a number of organizations and companies that provide what are called dynamic DNS services, where for a fee, they will give you a DNS hostname. They do not redirect traffic to your IP address (which would involve traffic passing through their servers), but instead they point the computer requesting your IP address to the correct IP location. Using a service like this ensures that whenever there is a request for your domain, it will always know where to point visitors.
If your dynamic address at home is always changing, how do they know what your current address is? Simple, you use a "client" application on your computer that pings your current local IP address, detects whether or not there has been a change, and updates the dynamic DNS service's database. So, if my current IP changes from 18.104.22.168 to 22.214.171.124, the program takes that second number and sends the update to the dynamic DNS service. Easy as pie!
I use a service called DynDNS. You can find a pretty good FAQ on this service here. They ask for a one-time $30 fee (I believe), and that's it. If you use the service you should support them by making a small donation each year. The client I use is a carbonized freeware application called Mac Dynamic DNS, written by James Sentman. It has a number of features that allow for some pretty advanced scheduling and logging. She ain't pretty, but she does the job reliably. You can find the application on the DynDNS site.
Now, I want to point out that you don't have to register your own domain name to use this service. DynDNS has a number of existing domains that you can use. For example, you could create a domain name similar to yourusername.homeunix.com. This saves you the nominal cost of setting up a domain name, and still gives you the ability to point people to your computer. Just like creating a .Mac identity, no?
Go ahead and set up an account and make the donation. It may take up to 48 hours for confirmation from their donations department that your donation was received, so be patient.
Go to the Network Preferences Pane and make sure your network connection is set to DHCP so that your ISP will properly assign you an IP address.
A Note About Firewalls/Routers: If your Internet connection travels though Firewall software or a Router, you may experience some trouble accessing your computer. Make sure it is set to accept inbound connections to port 80 (the default for HTTP requests). If you are using a cable/DSL router, make sure you've properly set up port forwarding (check your router's manual for instructions). Still having trouble? Check if your ISP blocks inbound connections to port 80 (some have done this because of Internet worms). If this affects you, set up your HTTP server on a different port (for example, 8080).
Now, if you've made your donation, and followed the DynDNS instructions to create your account, you need to add this account information to the Mac Dynamic DNS application. It has an easy-to-follow "wizard" that will walk you through creating the client account. Set this as your master account, turn the account on, and click "Check Now" to update your IP address with the DynDNS service. When it has communicated with the service, it will show your current IP address in the window. Don't forget to set the application's preferences to automatically update the address!
Because I don't know how often my DSL provider updates my IP, I've set the Dynamic DNS application to check my connection every 15 minutes, and notify DynDNS.org of any changes.
Important Note: Be sure that you set this application (and its background application) to launch at startup via the Login Preferences Pane.
Now, go to the Network Preferences Pane and check that your computer's IP address is the same number that's listed in the Dynamic DNS application. If so, your computer is properly communicating with the DynDNS site. I can't stress how important it is that your router isn't assigning an internal IP address without proper Port Mapping.
Next, head over to the Sharing Preferences Pane. If Web Sharing is off, turn it on. If you would also like to have ftp access to your computer (I'll cover this later) enable it here.
Important Tips: While you can allow your display and HD to go to sleep, it is important to keep your entire system from going down. In the Energy Saver Preferences Pane, be sure to set "put system to sleep," to never. You should also tell the computer to restart after a power failure. One last item, you need to be sure that Login will automatically log a user in to ensure the server and Dynamic DNS software will start up. If you are concerned about security, create a auto-login account with a name like "server" that will run your Web server, but won't give anyone access to your administration or other accounts. You can always log out of this account and log back in as yourself.
OK, here is where we find out if you have everything set up properly. Open up a Web browser and type in your DynDNS Domain Name (http://yourname.homeunix.com or whatever) and hit return. You should see this logo on a Web page:
Congrats! Your Web server is up and running.
If your computer has multiple users with separate accounts, you need to make the same settings across each account to ensure that when people log into their account, the server will remain running. Also, be sure the DNS client launches on login to each account.
Let's recap. We've set up our basic Web server and tested it to see that it works. We can now host our own Web pages and databases on our home computer. We can also set up our own version of iDisk, which is limited only by the storage space on our HD. In future articles, we'll complete our .Mac clone and start using it. You know what they say, "When Apple closes a door, just start looking for the window."
In Part 2, we'll add our own Web site, set upand move our own domain name, setup a Firewall, create our own version of iDisk, learn FTP, and launch our Web site.
Alan Graham is the creator of the Best of Blogs book series and is a frequent writer on the O'Reilly Network.
Return to Mac DevCenter.
Copyright © 2009 O'Reilly Media, Inc.