Today we begin our five-part series on building a full-featured Internet hosting server with a Mac mini. If you’ve followed our previous advice and are considering a move to a hosting provider for your web sites, then this series will show you how to build the perfect staging server, a place to experiment with new code before moving it to a production environment. Over a year ago, we undertook a similar project on the Windows XP platform. The difference in performance, security, and ease of deployment on the Mac platform is the difference in night and day so you’re in for a treat! For those unable to afford the move to a hosting provider at this time, you can use a Mac mini as your host for the time being. Functionally, there’s nothing a hosting provider would give you that can’t be replicated for free on the Mac mini. Other than bandwidth and slightly better performance, the Mac mini will provide an almost identical hosting environment to what you’d be using with a commercial hosting provider. In fact, we recommend installing application versions which match what most reputable hosting providers use, and we will do that here. If you later decide to make the move to a hosting provider, everything you’ve built on your Mac mini can be transferred with ease. Listed below are the pieces we’ll be putting into place over the next week or so to complete our ISP-In-A-Box project:
Our focus today will be on the hardware and web server software you’ll need for this project, and then we’ll get the Apache Web Server up and running to host your first two web sites. Luckily for you, Apple has made this project incredibly easy … and cheap. You’ll need a Mac mini which includes Mac OS X and FreeBSD ($499). Like Linux, FreeBSD is another UNIX derivative so most of the rock-solid Internet applications available for Linux have also been ported to FreeBSD. And, also like Linux, most of these applications are free at least for non-commercial use. Unlike Microsoft where security has been an afterthought and Linux where you have to track down patches and dependencies yourself, Apple takes security seriously and automatically notifies you when patches become necessary to keep your machine safe and secure. One button click and an admin password, and you’re up to date with the latest fixes and enhancements. If you’re serious about having web applications accessible from the Internet, there really are no sane options other than the Mac platform or contracting out your web hosting. Then again, perhaps you need another full-time job in which case Linux or Windows servers will gladly suck up every free minute of your day.
Hardware. Since the Mac mini only has one RAM slot and because Apple has made Mac mini hardware upgrades difficult (but not impossible), you may want to consider at least bumping the machine up to 512MB ($75) when you initially order it. This will almost double the performance of the box for applications such as those we’re going to be deploying. Extra RAM is particularly important once we get all of the ISP functions (shown above) running simultaneously. The other option that’s too inexpensive to pass up is increasing the hard disk size from 40GB to 80GB. For $50, you’ll never be sorry. If $499 is your absolute budget, then fine. Everything outlined here will chug along on a $499 Mac mini. If you can scrape together another $125, you’ll have a much more capable system down the road when you really start exercising the server capabilities of the Mac OS X platform.
Unlike Microsoft, which cripples Windows XP Home Edition by not including a web server, Apple has taken just the opposite approach with Mac OS X, the operating system which is included with your Mac mini. Because Mac OS X is built on top of the FreeBSD platform, Apple has included most of the FreeBSD development tools in its software distribution. Enabling the Apache Web Server on your Mac mini may just be the easiest thing you ever do on the computer. Click on the upper left corner of your display and then choose System Preferences. When the System Preferences window appears, click on the Sharing folder under Internet & Network options. Under the Services tab, place a check mark in the box beside Personal Web Sharing. If the system won’t let you select this option, click the Lock and enter your administrator password. If you want people on the Internet or your local network to be able to access your web site, you also need to enable Personal Web Sharing under the Firewall tab. You do have your firewall enabled, don’t you? If not, do it now! Once you complete these steps, open your web browser and enter localhost as the destination address to find. You should see the Test Page for the Apache web server with the Apache logo. Congratulations! You’re now a webmaster.
Actually, your Mac mini is now hosting at least two different web sites. The main web site which is accessible at localhost, 127.0.0.1, or your Internet IP address is the one we’ve already accessed. If you open a Finder window and select your local drive icon, this will move you to the root directory. Then choose Library, Webserver, and Documents to move to the directory where HTML pages for your main web server are stored. The default web page is index.html or index.html.en if you’re supporting multiple languages and English is your computer’s native tongue. There’s also a web site for each user account on your Mac. Documents for these sites are stored in the Sites folder of your home directory. You can access this web site at the following address: http://localhost/~yourname where yourname is the account name you set up when you first turned on your Mac. When you access this site, Apple even provides instructions for building your first web page. Your personal web page can be accessed from the Internet with an address such as http://nnn.nnn.nnn.nnn/~yourname where nnn.nnn.nnn.nnn represents the IP address provided by your ISP.
Finally, you’re probably whining because most folks don’t access web sites with an IP number and most ISP’s assign dynamic IP addresses which are always changing. Right you are to complain, on both counts! Here’s what you need. First download DNSupdate and install it on your Mac. This software regularly talks to a DNS server to tell it what your current IP address is. Next, set yourself up a dynamic DNS name on DynDNS.org. Once you complete both these steps, people can access your web site on your home network using a domain name just like mine. Using a web browser, type in wmundyhome.dyndns.org to see how it actually works.
Tomorrow we’ll get your email server up and running on the Mac mini with about the same amount of effort it took to activate Apache. Until then, here’s hoping you enjoy your first day as a webmaster. Click here to read the rest of the articles in this series.