Serving Up a Web Site with the Built-In Apache Server

With the Apache web server under the hood, OS X is a web powerhouse right at your very fingertips.

Apache is one of the most popular, if not the most popular, web server available today. It has support for literally anything you want to do. Jaguar ships with Version 1.3.26 of Apache, and all you need to do to start it up is to click a single button in your System Preferences application. Here’s how.

Open up the System Preferences application. If it’s not on your Dock, then you can find it in the Applications folder of your hard drive. Once launched, click on the Sharing button, then click on the Personal Web Sharing checkbox, as shown in Figure 8-13. Don’t let the name Personal Web Sharing fool you. This is the full-strength Apache web server running, no matter how innocent or lightweight it sounds in the preference panel.

Turning on Personal Web Sharing

Figure 8-13. Turning on Personal Web Sharing

That’s it. You can now point a web browser at your machine’s IP address, hostname, or http://localhost and see the default Apache home page — yes, the one with the big “Seeing this instead of the Web site you expected?” caption. This rather bland default home page is located in /Library/WebServer/Documents, the home of your web site on this machine. Easy huh?

User Sites

If you’ve ever had a web site hosted at an Internet Service Provider (ISP), you’re probably used ...

Get Mac OS X Hacks now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.