macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Setting up a Site Server with Jaguar
Pages: 1, 2, 3, 4

Dynamic IP Address Options

If you have a dynamic IP, then you really only have one option. You should use DynDNS.org's Dynamic DNS service to set up a DNS name that will map to your IP address. This will allow you to alias a dynamic IP address to a static hostname. For more information about this, see Alan Graham's "Homemade Dot-Mac with OS X."



You can use your own domain name (to be covered in part 2 of Alan Graham's upcoming Homemade Dot-Mac article), but if you want to forgo the registration fee and save a few bucks, you can use one of the many domains that DynDNS manages. For example, you could have a hostname of something.dyndns.org, someone.is-a-geek.net, or even macosx.kicks-ass.net. There are 34 choices (at the time of this article's writing) to choose from, so it shouldn't be too hard to find something that works for you and suits your personality.

DynDNS provides this service for free, and it's quite easy to set up. All you need to do is to follow the directions at their Web site to set up an account, map your IP address to the hostname you choose, and then download the DNSUpdate client to run on your server, which will update DynDNS every time your IP address changes.

Static IP Address Options

If you have a static IP from your Internet provider, then you have several choices.

  • Use DynDNS.org, as above, but use a static DNS account.
  • Use the hostname your ISP gave you. Typically, this is something like "dsl092-007-021.sfo1.dsl.speakeasy.net," and isn't very attractive. You can find out what it is by using the nslookup command and giving it your IP address as an argument.
  • Get a domain name of your own and have the domain name registrar point it at your machine.

If you want to follow step three, there are many companies that are more than willing to help you out with the process. Your ISP is probably one of these companies. I personally use Register.com to manage all of my domains and to point them at my servers, and have had good luck with them.

For the truly self-reliant, there is actually a fourth choice. You can actually serve your domain from your machine with BIND. BIND ships with Jaguar as /usr/sbin/named and is the same software most of the Internet uses to resolve domain names. However, setting up BIND can be a bit of a pain, and can be a security risk as well. It is much simpler to just let a domain registrar, such as Register.com, take care of this for you.

If you really want to go this route, I recommend that you get DNS and Bind, by Paul Albitz and Cricket Liu.

Second Stop: Setting up Apache

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. Don't let the name "Personal Web Sharing" fool you. This is the full-strength Apache Web server running, no matter how innocent it sounds in the preference panel.


Screen shot.
Firing up Jaguar's Apache Web server is as simple as click on the Sharing button in System Preferences.

That's it. You can now point a Web browser at your machine's IP address or hostname and see the default Apache home page -- yes, the one with the big "Seeing this instead of the Web site you expected?" caption. This home page is located in your filesystem in the /Library/WebServer/Documents folder. Just change the files located there and your Web site visitors will see them. Easy huh?

Kevin Hemenway talks more about this in his excellent article, "Apache Web-Serving with Mac OS X: Part 1."

Behind the Scenes: The Configuration Files

But what's really going on here? Let's look behind the scenes and see what the Unix core of Mac OS X is doing.

When you click that innocent looking "Personal Web Sharing" button in the System Preferences application, what happens is that a flag gets changed in the /etc/hostconfig file. This file tells Mac OS X which services should be started. Mine looks like the following:

% more hostconfig
##
# /etc/hostconfig
##
# This file is maintained by the system control panels
##

# Network configuration
HOSTNAME=-AUTOMATIC-
ROUTER=-AUTOMATIC-

# Services
AFPSERVER=-NO-
APPLETALK=-NO-
AUTHSERVER=-NO-
AUTOMOUNT=-YES-
CONFIGSERVER=-NO-
CUPS=-YES-
IPFORWARDING=-NO-
IPV6=-YES-
MAILSERVER=-NO-
NETBOOTSERVER=-NO-
NETINFOSERVER=-AUTOMATIC-
NISDOMAIN=-NO-
RPCSERVER=-AUTOMATIC-
TIMESYNC=-NO-
QTSSERVER=-NO-
SSHSERVER=-YES-
WEBSERVER=-YES-
SMBSERVER=-NO-
DNSSERVER=-NO-
CRASHREPORTER=-YES-
APPLETALK_HOSTNAME=Titanium

By looking at this file and seeing the line WEBSERVER=-YES-, Mac OS X knows that Apache should be on. If you are observant, you'll have noticed that in the System Preferences screen shot above, I have my Remote Login service turned on, as well as Personal Web Sharing. This corresponds to the -YES- flag being set for the SSHSERVER entry. We'll be back to this file later as we set up the mail services for our server.

The other file of interest is Apache's main configuration file, found at /etc/httpd/httpd.conf. The default file in Jaguar is sufficient for most people. But, if you need to do something with Apache that isn't enabled by default, all you need to do is edit this file and restart the Web server.

If you want to dig deeper into Apache on Mac OS X, I recommend Kevin Hemenway's Apache Web Serving with Mac OS X series. A couple of books that will help you learn more about Apache in general are Apache: The Definitive Guide and the Apache Pocket Reference.

Next Stop: Setting up Sendmail

Sendmail. It's a program that makes many shudder at the thought of complexity. And it's true, Sendmail does have a reputation for being hard to configure. It is literally the swiss-army knife of mail servers. It can do anything you tell it to do, as long as you know how. Fortunately, we don't have to do too much with Sendmail to get things working. And since it comes built into Mac OS X, it's the best choice for us.

Pages: 1, 2, 3, 4

Next Pagearrow