Using Mac OS X Panther Web Sharing

With .Mac, Apple takes care of the Web server for you, but you aren't limited to .Mac: You have other options when it comes to posting Web pages. Mac OS X comes stocked with its own high-powered Web server, so you can run things without .Mac. Consider the advantages, won't you?

  • Privacy: Everyone in the house wants access to the family phone book. You want all computers on your home network to see the telephone list but not the whole world. Posting it on the home network keeps it secure from prying eyes outside your home.
  • Your own domain: Want a name like Anyway, if you run your own Web server, you can arrange for your own domain name.
  • Speed: Your friend needs a copy of your iMovie masterpiece for a class project. Rather than wait for you to post the file to your iDisk, he decides to download it directly from your computer.
  • Coolness factor: It's fun, easy to do, and your mother will truly be proud. Seriously, it is fun and easy to run your own Web server. (And although your mother might not actually give a hoot, companies like employees who know useful skills; therefore, Web server stuff is good to know.)

Confessions of a UNIX Webmaster

Deep in the guts of Mac OS X lies one of the most popular Web servers around: Apache, which turns your Macintosh into a full-featured Web server. The Apache Web server is well known around the world and comprises about half of all personal and commercial Web servers in use today. Yes, that's right! You have one of the world's most-used Web servers already installed on your Mac!

By now, you might be wondering what makes Apache so great. Apache's first appealing feature is its price — absolutely free. Free is sassy! Free isn't any good without quality, though. Fortunately, Apache delivers in this aspect as well. It's extremely reliable — and combined with the crash-proof Mac OS X, you can be almost certain that your Web server will always be available. Besides being rock-solid and free, Apache sports all the features you'd expect from a top-notch Web server, such as techno-wizard integration with databases and scripting languages. Honestly, it can serve anything you throw at it.

Configuring and running Apache

In addition to all its great qualities, Apache is dead simple to operate in Mac OS X. Open the System Preferences and click the Sharing icon; then mark the check box next to Personal Web Sharing to launch Apache. That's it! It doesn't get any easier . . . at least, when it comes to turning on Apache. (See Figure 1.)

Figure 1: Start your Web server with only one click in System Preferences.

To begin using your Web server, open a Finder window and navigate to the Sites folder that resides in your Home folder; this is the root of your personal space on the Web server. Any files that you add to this folder will be accessible via your Web server.

You might find a file named index.html already installed in the Sites folder. This is the default file for your Web site. To view it, open your favorite Web browser and load this URL, replacing ~username with the username that you're currently using:

The address is a generic Internet Protocol (IP) address, which means self. (In other words, your Mac is connecting to itself. Faintly unsettling, but absolutely legal.) You can also use your real IP address, which appears at the bottom of the Sharing panel in the System Preferences when you turn on Personal Web Sharing.

To see the Web page from another computer, you must use the real IP address. The address is merely a convenience for use when you're using the actual machine that runs the Web server.

Because Mac OS X is a multi-user environment, each user can host a Web site. The key is the username found at the end of the URL; replace it with the appropriate username, and you're ready to go. If everything goes smoothly, you should be viewing the default Mac OS X Web page, as shown in Figure 2. The default page displays a welcome message and some important information for Web-sharing beginners. Make sure that you read the information carefully.

In addition to a main page for any individual that logs in, the Web server also has a global default page. To find the global default page, follow these steps:

1. Open a new Finder window.

2. Double-click the drive that contains your Mac OS X installation.

3. Choose Library --> WebServer --> Documents.

Here you'll find dozens of HTML files. These files are the default global home pages for many different languages. For English versions of the Mac OS, this means that the file named index.html.en serves as the default home page for the server. To view this file in your browser, try this URL:

This will display a Web page like the one shown in Figure 3.

Figure 2: The default Apache Web page for your username greets you upon your first visit to the site.

Creating Web pages

To change the default Web page, simply open it in your favorite HTML editor and start changing it. An HTML editor is an application that lets you lay out your Web page with what-you-see-is-what-you-get (WYSIWYG) ease. If you're familiar with a word processor, you're well on your way to using an HTML editor. Of the many HTML editors available, VersionTracker will give you a good head start on finding some of the most popular ones.

You aren't limited only to HTML editors, of course. Many word processors support HTML export, so it's a cinch to create Web pages with them by simply choosing File --> Save As.

If you already know HTML (Webmasters might say, "If you can bang out raw HTML code"), you can edit your Web pages by hand. Simply open the existing index.html file with a text editor like TextEdit or BBEdit by choosing File --> Open and change it to suit your needs. For example, a simple Web page might read like this:

<head><title>My First Web Page</title></head>
Welcome to my Web site!

blog comments powered by Disqus

Inside Sweepstakes

Win $500. Easy.