Home » Technology » Apple & Macs » ISP-In-A-Box: The $500 Mac mini (Chapter X, Web Sites 101, Part II)

The Most Versatile VoIP Provider: FREE PORTING

ISP-In-A-Box: The $500 Mac mini (Chapter X, Web Sites 101, Part II)

Today we finish up our two-part series on a few webmaster fundamentals that you will need before we can build some of our upcoming web projects. The tasks assume that you already have an Apache Web Server up and running and that you have installed Webmin which we covered last week. As in past columns, our preference is that you first at least read through our previous ISP-In-A-Box tutorials (available as a PDF collection here) so that you have a basic understanding of how to do things, but that√¢‚Ǩ‚Ñ¢s up to you. Yesterday we showed you how to assure that directories without a default web page never display, and you learned how to password-protect web site directories. Today we’ll show you how to configure Apache to serve up multiple web sites from a single web server, yours.

There’s no reason you can’t have more than one domain with your new web server. And each can have its own independent web site. Whether it’s static or data-driven is, of course, up to you. You also can build fully-qualified subdomains for all of your kids or small-business departments, and let them maintain their own web sites using the Mac’s built-in user accounts. For example, web sites for johnny.begood.com and betty.begood.com would be built in the Sites folder for accounts set up on your Mac as johnny and betty. Then it’s a simple matter, with Omnis.com’s DNS tools, to point johnny.begood.com to the appropriate web site using a Proxy (aka mod_proxy) record for the begood.com domain that looks like this (substituting your own IP address, of course):

  • Namejohnny
  • TypePROXY
  • Contenthttp://111.111.111.111/~johnny
  • But suppose you want to have two completely different domains with two completely different web sites, and you don’t want to have to create separate Mac accounts to maintain each domain. That’s not a problem either. Apache was designed to do just that. We’re going to use Webmin to configure a second domain which we’ll create in a new folder called calendar off our main web site tree: /Library/WebServer/Documents. Note, however, that you shouldn’t create the calendar folder under the default Documents folder unless you don’t mind that folks visiting your main web site (http://mydomain.com) can also access the calendar web site by going to http://mydomain.com/calendar. If you want to prevent this, then you’d create the calendar folder at the same level as the Documents folder, i.e. as a new folder in the /Library/WebServer folder. The only drawback of the latter approach is that you can no longer access the site using the http://localhost syntax. I’ll bet you can figure out why.

    The first step is obviously to register a second domain and use the registrar’s DNS service. We’ve previously covered this (here) if you need some help. Once you have done that, create two new DNS A records that point to your IP address. Apache will handle figuring out which domain is hitting your web server. Note that you cannot use Proxy records if you want Apache to resolve the domain names. If you use Proxy records, you can distinguish various web sites by assigning each domain to a different port, e.g. 82, 83, and 84. The syntax for the Content would be http://111.111.111.111:81. You also would have to enable these ports in the Apache config file by searching for the word "Listen" in httpd.conf and adding separate lines for each port you wish to enable: Listen 82, Listen 83, and Listen 84. Then you would restart Apache. For now, let’s use A records which are a bit easier to implement:

  • Namewww
  • Content111.111.111.111
  • Name@
  • Content111.111.111.111
  • We’re now ready to configure Apache to handle the second domain. Make sure Webmin is running on your server (/etc/webmin/start), and then open a web browser and go to http://localhost:10000. Click on the Servers button and then click Apache Web Server. At the bottom of the page is a form to Create A New Virtual Server. Just fill out the form with these settings and leave the other defaults the way they are. Then click the Create Now button.

  • Handle connections to addressany address
  • Portdefault (if you were using the Proxy port approach, you would specify port 82, etc. here)
  • Document root/library/webserver/documents/calendar
  • Domainmydomain.com (use the real name of your second domain here)
  • For your changes to take effect, you’ll need to stop and restart your web server. This can be done at the top of the form by clicking the Stop Apache button and then the Start Apache button.