|Page (1) of 2 - 04/28/06||email article||print page|
Mac OS X Web Server Tips for Designers, Part 1Most everything you need is built right in
OK, so you're a Web designer. Perhaps it's all you do, or perhaps it just a small part of what you do, but wherever you happen to be on the Web design food chain, you can definitely benefit from setting up and using the Web server that is included with every installation of Mac OS X. And while many of you may already have the server running, there's a lot more that could conceivably be done to soup things up a bit.
Tip #1: Learn the basics
You already know that the Mac OS X Web server is based off of the open source Apache Web server, right? Well, even if you didn't, you'll figure it out the first time you enable the server and look at your computer's home page (fig. 1). Now, if you're not yet in the know, the immediate and obvious issue would be how one would even enable the server in the first place, if one were so inclined. While I suspect that this is redundant information for many of you, in the interest of being thorough, let's go through it real quick (and please note that these instructions are for Mac OS X 10.4 "Tiger," but should be similar on earlier versions):
- Launch System Preferences from the Apple menu
- Click the Sharing icon
- Select the Services tab
- Check the Personal Web Sharing box (fig. 2)
- There's no step 5
That's it folks?your Mac is now serving Web pages. If you're satisfied with just turning the server on, you can stop right there. However, since you've probably gotten this far on your own already, you might as well stick with me here as we go over a couple more of the basics. Let's move on to where Mac OS X keeps pages. There are actually several places to stash your pages:
- In the Sites directory of your Home folder (fig. 3)
- In the Sites directory of any other user of your system
- In the /Library/WebServer/Documents folder
The first two are only accessible (in this context, "accessible" means "writable") to individual users, but the last one is available to anyone with admin privileges on your machine. So feel free to dump whatever Web content you like in those areas (assuming you have access, of course). Still with me? Good. One last bit of elementary knowledge: now that the server is active, and you know where your pages are, I suppose you want to know what the URL is to your machine. There are actually four(!) things you can put into the address field of your Web browser to access your server:
- The IP address of your system (e.g., http://192.168.0.2/)
- The Computer Name of your system (e.g., http://ComputerName.local/)
Now, for others on your network, only the latter two are acceptable, since the first two only apply to your host machine (but if you click on either of the first two, you'll be taken directly to your own server). Otherwise, all four are completely interchangeable. Please note that those addresses will take you directly to the /Library/WebServer/Documents folder mentioned earlier. To access the individual user directories, you'd append a tilde and the short username to the address. So, for example, if I wanted to access my own directory on my machine using the fourth type of URL, the address would be:
If I actually go to that URL, I'd get Figure 4.
Makes sense so far, right? Anyway, that's Web server 101 for Mac OS X. Congratulations; you all passed. Let's move on.
Tip #2: Get to know your conf file
For some of the upcoming tips in both this and the next installment, we're going to be playing around with the Apache httpd.conf file. I know, I know; I can practically hear the sound of eyes glazing over at the mere thought of messing with configuration files, but I promise to keep this as painless as possible (read: we aren't going to go anywhere near the Terminal). You will need two things, however. One, you're going to need admin privileges on your machine, or else you won't be able to do any of this. Two, you'll need a text editor, but to really make this simple, you'll need either TextWrangler (free) or BBEdit (uh, not free), because you'll be able to edit the configuration file directly from either of those two programs. So, if you don't have either one, do yourself a favor and head to the Bare Bones Web site to at least download TextWrangler. Once you've got it up and running, you'll be ready to roll.
Related Keywords:web design, mac os x, web server