Home » Technology » Internet/Web (Page 14)

Category Archives: Internet/Web

The Most Versatile VoIP Provider: FREE PORTING

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

Today and tomorrow, we're going to cover a few more fundamentals that you will need to master before we can build some of our upcoming web projects. Today's 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. Our three projects for today and tomorrow are assuring that directories without a default web page never display, learning how to password-protect web site directories, and mastering how to configure Apache to serve up multiple web sites from a single web server, yours.

Preventing Display of Web Site Directories With No Default Web Page. As delivered by Apple with your new Mac, the default Apache configuration tells your web server to display a directory listing of any web site directory that does not have a default web page (index.html or index.php). That means that, if you create subdirectories below /Library/WebServer/Documents, the contents of each one will be shown to any visitor that guesses the name of the directory. If you happen to have your tax returns stored there, you see the problems this might cause. To demonstrate what I'm talking about, let's create a directory and then access it with a web browser. Open a Terminal window and switch to root access: sudo su. Now create a directory called emrem under your main web site: mkdir /Library/WebServer/Documents/emrem. Switch to your web browser and access the new site: http://localhost/emrem/. See what I mean. If you had filled emrem with documents, they would be accessible to anyone on the Internet. The same default applies to your personal web site at http://localhost/~username and subdirectories created in your Sites folder. For security's sake and your own peace of mind, I prefer defaults which specify that the contents of directories not be displayed unless you expressly authorize it. So here's how to fix it. Switch back to your Terminal window with root access. Move to the Apache configuration directory: cd /etc/httpd. Now let's edit the Apache config file carefully: pico httpd.conf. Search for the word "indexes": Ctrl-W, indexes, then enter. We're looking for every line in the config file that begins with the word "Options" and contains the word "Indexes." This probably won't apply for the first match of the word "Indexes" so move the next occurrence of the term: Ctrl-W then enter. You should get a match on this one. Position the cursor under the "I" in Indexes and press CTRL-D until the entire word is deleted. Then search for the next match, and repeat the drill until you get to the bottom of the file. Now save your changes: CTRL-X, Y, then enter. Now stop and then restart Apache for your changes to take effect (covered in our Apache tutorial). Then access http://localhost/emrem/ again, and you should get an access denied message.

Password-Protecting Web Site Directories. There also will be times when you want to build web sites on your server which are available over the Internet, just not to everybody. The easiest way to accomplish this is to prompt for a username and password to log in to certain sites before any access is provided. Apache handles this for any web browser, but you first have to enable it. Then you need to build a password file and store it where Apache can find it, but your web site vistors cannot. And finally, we need to insert an .htaccess file in every directory that you want to password-protect for Internet access.

Configuring default htaccess file. To get started, Ctrl-Click here and Download the Linked htaccess File to your Desktop. Do not save the file with a leading period in the file name. We'll do that later. Open Finder, click on your local hard disk, and navigate to the /Library/WebServer folder. Now Click-And-Drag the htaccess file on your Desktop to the /Library/WebServer folder. Close your Finder window, and then open a Terminal window. Switch to root user access: sudo su. Provide your admin password if prompted. Now we want to clean up the ownership and permissions for our sample htaccess file so move to the directory where we put the file: cd /Library/WebServer. Make root the owner of the file: chown root htaccess. Make admin the group for the file: chgrp admin htaccess. Now set the file permissions for world read access only: chmod 774 htaccess.

Configuring Apache for Password-Protected Directories. Now we have to configure Apache so that we can password-protect directories. The default Apache configuration would ignore our .htaccess file. Using your Terminal window with root access, move to the Apache configuration directory: cd /etc/httpd. Now let's edit the config file carefully: pico httpd.conf. Search for the word ".htaccess": Ctrl-W, .htaccess, then enter. This will position the cursor on a comment about using .htaccess files to override Apache settings. Immediately below the comment is a line which begins with the word "AllowOverride." We want to replace the word after AllowOverride with the word "All" (without quotes). Move the cursor to the beginning of the word to be deleted and press Ctrl-D until the word is deleted. Then type All. Save the config file: CTRL-X, Y, then enter. Now stop and then restart Apache for your changes to take effect (covered in our Apache tutorial).

Building a Password File. The password file is where Apache looks to determine whether one of your web site visitors (including you) is allowed access. There are a couple tricks to this. First, you want to put the file where Apache can read it, but your web visitors cannot. And you want to be careful not to insert blank lines in the file with just a colon. That basically lets everyone in. The format for the file is username:password, each on a separate line. And the password are encrypted. Here's how to do it. Open a Terminal window and switch to root access: sudo su. Now let's move to the directory where we'll put the password file: cd /usr/local. We're going to name our password file users.pw to match the htaccess file that you already downloaded. To create the file and erase any existing file without warning type: htpasswd -c users.pw admin. Think up a password you can remember, and you'll be prompted to type it twice. Now let's verify that the file was created: cat users.pw. You should see the word admin, then a colon, and then your encrypted password. To add additional users to your existing file, just type: htpasswd -b users.pw username password. Remember, if you accidentally use the htpasswd -c syntax a second time, you will overwrite your existing file and all of its entries. So be careful.

Password-Protecting A Directory. The way you password-protect a given directory on your web site is to copy the htaccess file we downloaded earlier into the desired directory, and name it .htaccess (with a leading period). So let's try it. Move to the nerd directory we built previously: cd /Library/WebServer/Documents/nerd. Now copy the htaccess file into the directory: cp /Library/WebServer/htaccess .htaccess. Close your web browser and reopen it to http://localhost/nerd/ and you should be prompted for a username and password. Type in admin and the password you made up, and you should be admitted. If you're not prompted for a username and password, you probably forgot to restart your Apache web server after updating the Apache config file. If you can't get in with the the username and password you thought would work, just recreate the file, and try again. Suppose you change your mind and want to remove password protection from a directory. Switch to root access with Terminal: sudo su. Move to the directory: cd /Library/WebServer/Documents/nerd. And then delete the .htaccess file: rm .htaccess. You may have to change our browser and reopen it for the changes to take effect.

ISP-In-A-Box: The $500 Mac mini (Chapter IX, Building a Data-Driven Web Site: Part II)

Yesterday, we installed a data-driven web site on your new Mac mini as part of our ISP-In-A-Box project, but it was the contents of my web site (see inset). So today, let’s finish your site by filling it with your content. First, we’ll cover replacing the Nerd Vittles image (see inset) with either your own photo or Google Ads. Then I’ll give you a brief tutorial on the structure of this data-driven web site and how to modify it with PhpMyAdmin. And you’ll be off to the races.

If you’re new to the computing world and short on money, one of the must-have photography tools for your new Mac or PC is Photoshop Elements. Lucky for you version 3 has just been released. But, if you don’t have $70, not to worry. You can get version 2 which runs on both the Mac and PC platforms (same CD) for about $20. I still use version 2. Works great! Just a little less (ful)filling. To replace the Nerd Vittles image in the web site, just create your own image (728 x 90 pixels), Save For Web as a JPEG image, and name it nerd.jpg. Now drag it into the /Library/WebServer/Documents/nerd folder and replace the existing nerd.jpg file. Refresh your browser display at http://localhost/nerd to see your finished product. Take a look at the one we did for our home page at mundy.org if you need ideas. Or, if you’d prefer Google Ads (see sample site), then edit index.php in /Library/WebServer/Documents/nerd folder using TextEdit, search for nerd.jpg, and delete everything between the CENTER codes surrounding it. Now paste your Google 728 x 90 Leaderboard ad code between the CENTER codes to complete your page. Save the document, and you’re all set.

Now let’s customize your new web site with your own content. First, take a look at the site as it looks today. Use http://localhost/nerd if you’ve already completed Part I. Otherwise, just look at mundy.org. There are four columns of site links: a favorites column on the left and three others which are subdivided into topics. As already mentioned, all of the data to generate this site is stored in a single MySQL table. So, to change the content, all we have to do is edit the MySQL table and plug in your own links. The only trick to this is an organizational one. Before beginning the editing process, you need to lay out on paper what site links you want to include on your web site. You probably don’t want my kids’ email links. In laying out your site, you also need to come up with the categories into which you will place your various site links. Also keep in mind that you can have just over a dozen favorites in the left hand column, and the remaining columns all need to have approximately the same number of site links. Fifty is a pretty good ballpark number for site links in each column, and those should be subdivided into about four topics per column. You can always start with less and add more later. Just divide them up evenly so they can be spread across three columns. If you haven’t figured it out yet, this is the hard part. Making the adjustments to the MySQL table using PhpMyAdmin is pretty easy. Once you finish this project, I hope a few of you will be brave enough to post a comment below with a link to your site so we can all take a look and give you a little friendly feedback.

While laying out your site on paper, you should have come up with the subheadings for each section, and you should have defined which sections will go in which column and in what order. Now let’s number the columns (1 through 4) and the subheads in each column starting with 1. You can start the subhead numbers over with 1 in each new column. Finally, number the site links in each category starting with 1. If you have more than 9, use the alphabet after 9. Then start the site links over with 1 for each new subhead. On another piece of paper, let’s make a chart with seven column headings: Web Site Name (subject), Web Site Address (url), Description (comments), Column Number (category), Subhead Sequence Number (majorsort), Subhead Title (majorcateg), and Sort Sequence within Subhead (sortcode). The headings in italics are the actual field names in the MySQL website table. The headings in bold identify what information goes there. Having a description for any or all entries is optional. The other fields all are required. Now fill in the chart with your information. And, yes, I know the field names could have been more helpful, but the margaritas sure were good the night I originally designed this. Now, just so you’ll know, when index.php builds your data-driven web site (on the fly), it sorts all of the information in the website table by column number (category), then subhead sequence number (majorsort), then subhead title (majorcateg), then sort sequence within the subhead (sortcode). The only real gotcha is to make sure all of your subhead titles (majorcateg) are the same within a given subhead sequence number (majorsort), or you get extra subheadings in your page. It’s still no big deal. Just edit the table again to fix it.

Now that we’ve got our data squared away, let’s open PhpMyAdmin and get started: http://localhost/php/. Click on the Database pull-down in the left frame and choose mundy. Now click on the website table under the mundy database. Information associated with the Structure tab of the website table should appear in the right frame. Let me just note here that there is a bug in the frame code of PhpMyAdmin that causes the right frame to open in the left frame once it awhile. That doesn’t work too well because there’s insufficient real estate in the left frame to see what you’re doing. Don’t get frustrated if this happens. Just close the PhpMyAdmin browser window and then reopen it, and all will be well.

Once the structure frame appears in the right frame, we’re going to build a quick index so you can see how the data actually lines up in the website table to match our current web site. Look in the Indexes section of the right frame and find the line that begins: Create an index on 1 columns. Click on the numeric field (with the 1) and change it to a 4. Then press the Go button. Name your new index MyIndex. Leave the index type set to Index. Then use the four pull-downs to specify the index fields in the following order: category, majorsort, majorcateg, sortcode. Now click the Save button. You should now see your MyIndex index in the listing of indexes. Make sure the index order is correct. If not, click the red X beside MyIndex to delete it, and try again. Now click on the Browse tab at the top of the right frame to bring up the table browsing window. Just above the data is a line which reads: Sort by key. Click on the pull-down, choose MyIndex (Ascending) and click the Go button. The website table should now be sorted in the same order as the display of web links on the actual web page at localhost/nerd. Using the tab feature of your browser, you can flip back and forth between the web site and the website table to verify that they do, indeed, match. Notice also that the first three records have the same sortcode. This is an easy way to adjust the placement of a newly added entry (to move it further up your list) without having to renumber every entry. The last thing we want to do before we begin editing the actual table is to expand the table display to include all of the records in our file. Just above the table data is a line which reads: Show: 30 rows starting from record # 30. Change the first 30 to 300, and change the second 30 to 0. Then click the Show: button. Now the entire website table is displayed just as it appears on your current web site. As you make changes to your web site now, my advice is add or change a few records at a time, and then refresh your web page and make sure it looks and works the way you expected. A tabbed browser is great for this exercise by the way so kiss Internet Explorer goodbye (if you haven’t already).

You have two choices now. You can either delete some or all of the existing records and then insert new records of your own, or you can edit the existing records to replace the existing content with your own data from your chart. I’d recommend the latter at least until you know what you’re doing. To edit a record, click on the Pencil icon just to the left of the red X for the record you want to edit. To delete a record, you click on the red X. If you leave the existing records, then you won’t have to worry about the majorsort, category, and sortcode fields for the time being. And don’t ever change the recno (record number) field which must remain unique. Just change the majorcateg data to match whatever subheads you have chosen for your own web site, and plug in your own data for the subject, url, and comments fields. Once you’ve made your changes to a record, click the Go button to save your data and move back to the table browser window. Wait until you have finished editing and deleting existing rows in the table before you add new ones because clicking on the Insert tab clears the settings for your table browser window. When you’re ready to add new records, just click on the Insert tab at the top of the right frame. Leave the recno field blank, and MySQL will automatically fill it with a new, unique sequence number. Click the Go button to save your new record once you fill in the information for each field. That’s all there is to it. Enjoy your new web site … and let us all know where to go look for it!

ISP-In-A-Box: The $500 Mac mini (Chapter IX, Building a Data-Driven Web Site: Part I)

Our project for today and tomorrow is to construct a data-driven web site (see inset) using Apache, PHP, PhpMyAdmin, and MySQL. If you’ve followed along the past couple weeks and built an ISP-In-A-Box with us using your new Mac mini or any other Mac running a current version of Mac OS X, then you’re ready to go. If you’re from the Windows XP universe, you can do much the same thing using our Webifying XP tutorial from last year. Or, if you are using any computer or web hosting service that supports Apache, PHP, PhpMyAdmin, and MySQL, then you’re all set. Otherwise, pick one of the above, install the pieces, and then come back and join the party.

Game Plan. The plan of attack for today is to download and install my sample working data-driven web site on your server. You can look at a working version of what we are going to install here. Then tomorrow we’ll customize the web site with your content. We’ll use PhpMyAdmin to edit the MySQL database which actually stores all of the content for your new web site.

Prerequisites. In order to follow along on this project, you should already have bought your Mac mini and activated the Apache Web Server. Before you can actually build the data-driven web site, you must install MySQL and PHP and PhpMyAdmin. For your computer’s sake, we’d prefer you read the entire ISP-In-A-Box series (now in PDF format), but that, of course, is up to you. Before we begin, make certain that your web server and MySQL both are running. If you can’t remember the procedures to start them up, reread the tutorials referenced above.

Overview. As the name implies, a data-driven web site is one in which the content for the site is obtained from a database. The power and real beauty of PHP is that, when someone accesses your web site, Apache directs PHP to swing into motion and actually execute all of the instructions stored in your .php web page. In our case, the PHP instructions for the web site tell your computer to access a MySQL database and pour all the contents of the database into a web page template which we have constructed. PHP, however, is sufficiently flexible to allow you to build something much more sophisticated using virtually any database you or your company already has. That includes Oracle, Sybase, Informix, filePro, InterBase, mSQL, MySQL, PostgreSQL, and Microsoft SQL Server databases of any flavor as well as any other database with an ODBC connector. And the database need not reside on your home computer although in our case it will. Unless you will have a site with incredibly high transaction-oriented database processing activity such as a busy eCommerce web site which manages inventory as well as sales, MySQL databases are not only adequate but in many cases can run circles around expensive commercial databases such as Oracle and Informix. The moral of the story is don’t assume MySQL is going to clunk along just because it happens to be free. You will be amazed by its performance. Several of our beach webcam sites (pawleys.org and gardencitybeach.org) have thousands of visitors per day and use links to MySQL databases to look up tide and sunrise/sunset data from a huge 100-year MySQL table. The performance is virtually instantaneous, and you will see similar results. In the case of our sample web site, we’re only going to be accessing a hundred records or so which wouldn’t tax any database, but the idea here was to give you a model for future projects that might include large inventories of significant size. Using MySQL, the performance results will be almost identical with an indexed 100MB table as they are with our same database today. So let’s get started.

Installing the Sample Web Site. We’ve built a tarball (nerd.tar) containing all of the pieces you will need to construct the data-driven web site on your own computer. Just click here to download the file to your desktop which should decompress into a folder called nerd. If not, double-click on the nerd.tar file on your desktop to decompress it into a folder. Now there are three simple steps to complete today’s project. First, we need to create a MySQL database in which to store our website table. Then we need to import the sample data into the MySQL database. And finally we need to move our web site objects to their final home on your computer.

Creating a MySQL Database. To create the MySQL database in which to store our website table, we are going to use PhpMyAdmin which we installed last week. Using the web browser on your server, go to the following web site: http://localhost/php/. You should have a two-panel PhpMyAdmin display. If not, click on Home to open both panels. In the right-column box under the words "Create New Database" type mundy in lower-case letters. If there is a collation option in your version of PhpMyAdmin, choose UTF8_bin. Then click the Create button. MySQL should report that the mundy database was created. [If you’re doing this through a web hosting service instead of using your own server, then access cPanel for your web site, click on the MySQL icon, find the Db: section of the page, type in mundy for the database name, and click the Add Db button. To complete part (b) below, just click on the PhpMyAdmin link at the bottom of the screen you’re in.]

Populating the MySQL Database. Press the F11 function key to temporarily hide your web browser, and then Double-Click on the nerd folder to open it. Now Ctrl-Click on the website.sql file and choose Open With Other and pick the TextEdit application. When the file opens with TextEdit, click Edit in the TextEdit menu bar and then click Select All. All of the text in website.sql should now be highlighted. If not, try again. Now click Edit in the TextEdit menu bar again and then click Copy. This puts a copy of the website.sql file on your clipboard. Now press F11 to reopen your web browser. Double-click on the mundy database in the left column of PhpMyAdmin which will open a new window in the right column. Newer version of PhpMyAdmin have a tabbed interface in the right panel. If you see a SQL tab, click on it. Now click in the box immediately below Run SQL query/queries… to highlight it. Now choose Edit from your browser’s menu bar and click Paste to paste a copy of website.sql into the highlighted box in PhpMyAdmin. You should see several of the bottom lines of text from the file ending with an entry for "Atlanta gas prices." If you don’t see this, clean out the text box and repeat the steps above. Once all the text has been pasted into the text box, click the Go button immediately below the Run SQL Query box. MySQL will whirr away for a couple seconds and then report that the website table has been imported. Now close your web browser for the time being. And close the nerd folder on your desktop.

Bringing the Site On Line. Putting our data-driven web site into production is a piece of cake now. Using Finder, click on your local hard disk and move to the /Library/Webserver/Documents directory. Now click-and-drag the nerd folder from your desktop into the Documents directory you opened with Finder. Once the folder has been moved, you should be able to access your new web site by going to the following address with your web browser: http://localhost/nerd/. Or you can access it on the Internet using your new domain name with the syntax: http://yourdomain/nerd/. If you’d prefer to access the site as your default web site at http://yourdomain, then the contents of the nerd folder need to be copied or moved into /Library/Webserver/Documents and all the other files beginning with the word "index" (except index.php) need to be moved out of the Documents folder (either into a new folder for safekeeping or to the trash). You don’t need to move the website.sql file since we only needed it to import the original data into MySQL. [If you’re doing this through a web hosting service instead of using your own server, then you’ll need to make one minor change in the index.php file for this application. Open index.php with an editor and search for mundy. Most ISP’s use a MySQL database syntax like this: youraccountname_mundy. So just append your account name and then an underscore character before the existing database name mundy, and save the file.]

Meet us back here tommorow to learn all about customizing your new web site with your very own content. In the meantime, write down your favorite 100 web sites with appropriate links. We’ll need them tomorrow.

ISP-In-A-Box: The $500 Mac mini (Chapter VIII, Going Live!)

It’s time to put the final piece in our puzzle and actually "Go Live" on the Internet with our ISP-In-A-Box. "We don’t have a web site yet," you might be saying. Actually, we do. Go to http://localhost, and you’ll see it. It just doesn’t do much. But we will fix that early next week. If you want a preview of the data-driven web site we plan to build on your computer next week using PHP and MySQL, just click on this link. Once it’s built, you can customize all of the web content for your site using PhpMyAdmin to edit a simple MySQL database. It’ll even support Google Ads (as shown in the sample) if you decide you want to get rich quick or you can paste your favorite family photo on the top of your web page, but we’re getting ahead of ourselves. Our task for today is to get you a fully-qualified domain name so that people can access your web site from the Internet without typing http://24.98.82.246 (or whatever IP address has been assigned to you by your ISP).

Prerequisites. In order to complete today’s tasks, you should already have bought your Mac mini and activated the Apache Web Server. Before you can build a data-driven web site next week, you’ll need to install MySQL and PHP. If you haven’t already gotten this far, consider this your Saturday Night homework assignment. The entire ISP-In-A-Box series is now available in PDF format for download here.

Deciphering Your IP Address. Before we can link a domain to your IP address, we first need to know your IP adddress. If you don’t know it, you can obtain it by going to http://mundy.org/ip.php from the web browser on your Mac mini on the network connection where you plan to run your web server. You’ll also need to know whether you have a static (stays the same) or dynamic (ever changing) IP address. Chances are it’s dynamic.

Choosing An Internet Service Provider. Most ISPs only provide dynamic addresses unless you pay an additional fee. For about the same money, you can obtain a full-service web hosting account. Can you use a dynamic IP address and still host a web site from your house? The answer is maybe. While still using dynamic IP addresses, many ISPs including many cable providers rarely change your IP address. My experience with both Time Warner and Comcast is that they force an IP address refresh about once every six months. If you use one of these providers, you’re in pretty good shape hosting a web site from your home. Fortunately, AT&T is out of the broadband business. For a time, they actually blocked incoming port 80 access to customers’ machines. However, there’s even a workaround for that problem now which we will get to. At the other extreme in the ISP world are PPPoE providers such as Earthlink which disconnect, reconnect, and change your IP address regularly during the day, if not the minute. These ISP’s are all but unusable for hosting a web site from your home. If you have service from one of the latter ISP varieties, you have two choices: use your ISP-In-A-Box as a staging server and purchase a web hosting account for your "live" web site or switch to a more accommodating Internet Service Provider.

Choosing a Domain Name. There are two approaches in selecting a domain name for your ISP-In-A-Box. First, you can select a name such as wmundyhome.dyndns.org which rides on someone else’s domain and provides dynamic updating of your IP address whenever your ISP changes it. Or, second, you can purchase any available domain you like (such as webify.us), and manage IP address changes yourself. Either approach works. The latter is obviously more personal and more professional. And, with the right ISP, the manual updates of your IP address are not that burdensome. The two examples I’ve provided actually both point to the same server in my basement which is connected to the Internet through a Comcast cable modem. There used to be a significant difference in the cost of the two options; however, that has all but gone away. The dyndns.org solution is free, and the personalized domain is now less than $10 per year from many sources.

Using DynDNS.org. If you opt to use dynamic IP address updating, you first will need to register at DynDNS.org and obtain a username and password. What we’re going to do in this scenario is link a dynamic IP address to a static hostname for your computer. There is no cost. Whenever your ISP changes your IP address, your router’s built-in update client will notify dyndns.org of the change (after you configure your router to do so), and the DNS table will be updated for all the world to see. Step 1 is to select a hostname for use with one of dyndns.org’s registered domains. There are several dozen domains from which to choose. Log in to your dyndns.org account, click on Dynamic DNS, and then choose Add a Host. Enter the hostname you wish to use (your name with no spaces usually works well) and select a domain from the pull-down list. Then enter the IP address of your Internet connection which you obtained earlier. You’re finished at dyndns.org, and your qualified domain name (joeschmo.homeip.net) should be accessible on the Internet within a few hours. Sometimes it takes a bit longer. This domain name will continue to find your web site until your ISP changes your IP address.

To find your web site after an IP address change, you either have to manually update the address on dyndns.org’s web site, or you have to configure an update client to do it for you. Most new hardware router/firewall’s have this capability built in, but you’ll need to configure it. In addition, there is a Mac application, DNSupdate, which can do it as well. We covered that in our first ISP-In-A-Box installment although I hope I’ve pursuaded you not to put all your security apples in one basket to save a measly $30.

To configure your router for dynamic IP address updating, open the router admin program using your web browser. Typically, there is a Dynamic DNS menu option. You then would specify www.dyndns.org as the provider and insert your fully-qualified domain name, username, and password just as you entered it on the dyndns.org web site. Save your changes, and you’re good to go.

Using Your Own Domain. Becoming the master of your own domain is not a big deal these days. What used to cost hundreds of dollars is now under $10 with lots of features that we just happen to need. To make sense out of this article, we really needed to set up a domain to play with so we could walk you through all of the steps. I’ve done that with webify.us, which now is pointing to a server in my basement that’s connected to a Comcast broadband Internet connection through a Netgear wireless firewall, router, and print server. Yes, we do eat our own dog food before offering it up to you. We’ve chosen Omnis.com as our domain registrar for two reasons: they’re dirt cheap ($7.95 per year for most domains) and they offer a great feature set (DNS Manager, URL forwarding, and proxy routing) at no additional cost for those that want to run a web server out of their own home. Are there other suitable providers? Absolutely. But you need one that provides the feature set I’ve described, and no one today is any cheaper than the one we’ve chosen. Register.com provides a similar service for only $35 a year or $19.99 a year for multiple years. So you do the math.

The first step is obviously to select a domain that no one else has already registered. Most registrars have a link on their site to let you test various domains until you find one that’s available. For our example, we chose webify.us. Pretty clever, huh? Once you select your available domain, the registrar’s web site will walk you through the registration process during which you will set up a username and password to manage your domain. Write it down, and don’t lose it! It is a huge hassle to prove who you are these days. Make certain that you choose to use the registrar’s name servers during the registration process. Once the registration process is completed, go do something for a couple hours while your account is being set up. Your domain may not actually be available on the Internet until tomorrow.

The second step is to log into your account at your domain registar’s web site. In the case of Omnis.com, you click on the Manage My Account tab on the main page. Once you’re logged in, click on the Manage DNS option. You’ll be warned that this is dangerous but continue on. Once you get to the DNS page, click on one of the little question mark icons and read about Proxy and URL record types. These aren’t really legitimate DNS record types. They are special routines to make it easy to point a domain at a home IP address or a non-standard HTTP port, i.e. not port 80. Remember, I told you about AT&T’s cute trick of blocking port 80 access. The proxy record would let you point your domain to a different port, e.g. port 81 and reconfigure Apache to host your web site from that port.

For our purposes today, we’re going to use a Proxy record to point our new domain to our home IP address. Move to the DNS Manager – New Record section of the web form and make two entries. For the first entry, insert just the values shown below in italics on the form (leave the other fields alone) and use your own home IP address in the Content. Then click the Add New Record button.

  • Namewww
  • TypePROXY
  • Contenthttp://111.111.111.111
  • For the second entry, insert just the values shown below in italics on the form (leave the other fields alone) and substitute your own home IP address in the Content. Then click the Add New Record button again.

  • Name@
  • TypePROXY
  • Contenthttp://111.111.111.111
  • Now all you need to do is wait (usually several hours but it can take a day) for the DNS information to propagate to the DNS name servers, and you should be able to reach your home web site using your new domain name from anywhere on the Internet. That’s all there is to it … until your ISP changes your IP address. When this happens, just log back in to your registrar’s web site and modify the two entries above to point to your new IP address. Within a few hours, you’ll be back in business. Join us next week and we’ll build a real data-driven web site on your Mac mini that you can fill with any web content you desire. Have a great weekend.

    ISP-In-A-Box: The $500 Mac mini (Chapter VII, Network Security)

    We’ve built enough pieces for our ISP-In-A-Box now to start thinking about network security because we’re just about ready to put our web site on the Internet for all the world to see. We still don’t have a web site, but we’ll get to that. If you want to see the data-driven web site we’re going to build, click here. You’ll be able to add all of your own personalized content in under an hour. Unlike Nerd Vittles, the sample data-driven web site is actually running in our basement using a garden-variety Comcast cable connection to the Internet. Tomorrow, we’ll talk about what you need to do to connect your ISP-In-A-Box to a domain name, and we’ll provide a couple different ways this can be approached. That pushes back our backup solution and actually building our data-driven web site until next week, but we’re getting there.

    In the meantime, we need to get our security ducks in a row to make sure that, when we do put up our web site, it remains our web site and not some cracker’s. It has been reported that the average survival time for a new machine placed on the Internet is about 16 minutes before it is compromised. Pity the poor Microsoft Windows XP souls that have a half day of security patches to download (with a broadband connection no less) before they are anywhere near secure … and those are just the security flaws that Microsoft knows about! The Mac World is a little different since Mac OS X was built on top of a secure operating system (as opposed to DOS). Even when there is a reported problem in the Mac world (like yesterday), it typically requires a creep to be sitting in front of your computer or somewhere on your local network to do much damage.

    Security Options. To avoid compromising your new Mac, you have two choices to secure your machine before connecting it to the Internet: (1) turn on the Mac firewall or (2) install and configure a hardware-based firewall between your Mac and the Internet connection. DO BOTH! If you haven’t implemented either of these safeguards and you already have connected your Mac to the Internet, the safest course probably is to reinstall Mac OS X on a reformatted drive. Promising to do better and be safe henceforth without starting fresh is about as effective as a vow of celibacy after a summer of one night stands. Having said that and given Mac OS X’s almost flawless securiity record, I’m not sure I’d go to the trouble unless you’re seeing weird behavior on your machine. A third option to enhance the security of your Mac and your web site is to block all ports with your firewalls and turn your web site over to a hosting provider with experts on staff who do this for a living. Web hosting services are incredibly cheap these days with multiple site hosting plans available for well under $10 a month. With this scenario, you’d use your Mac mini as a staging server to build and test web applications before uploading them to your provider. Read our article on the subject if you want to learn more.

    Mac OS X Firewall. Turning on the Mac firewall couldn’t be easier. Click on the Apple icon in the upper-left corner of your screen, and choose System Preferences. Click on the Sharing folder and then the Firewall tab. Click on the Start button to set your Firewall On. The check mark beside Personal Web Sharing should already be checked if you have activated Personal Web Sharing (your Apache Web Server) in the Services tab. If it’s not checked, activate Personal Web Sharing in the Services tab and then repeat the drill. What we have just done is invite bad people around the globe to attack your server on ports 80 and 427 using any Internet connection they can get their hands on. Think about it! And, make no mistake, bad people will attack your server … daily! But we have to leave port 80 open for HTTP traffic (to view your web site) and port 427 is used by Mac OS X to communicate with file and printer shares on IP networks. Does activating the Mac firewall with port 80 open mean your web site is secure? No. It just means that would-be crackers must use the HTTP protocol to attack your site instead of walking in through a more vulnerable back door port and seizing control of your entire machine. Once again now, does this firewall configuration protect you against attacks from really bad people? Repeat after me, "Absolutely not!" If you want to read a really horrifying account of how the Internet world works written by one of the leading technology experts in our country, read Steve Gibson’s gem, DrDOS. What else can be done? Keep reading!

    Hardware-based Firewalls. So-called hardware-based firewalls are now a dime a dozen, almost literally. YOU WOULD BE CRAZY TO SURF THE WEB (MUCH LESS HAVE A PUBLIC WEB SERVER) WITHOUT FIRST DEPLOYING A HARDWARE-BASED FIREWALL. Pardon me for shouting. These devices used to be several thousand dollars or even more. Now you can get a very good one with a 10/100 megabit router and an 802.11G wireless router included for less than $30. dLink, Linksys, and Netgear have about 100 models collectively, and any of them will be better than nothing. One could write a book on choosing the best one and, before the book could be published, there would be a half dozen new models that were better than anything mentioned in the book. Without picking a favorite, let me suggest some features to look for:

  • Dynamic DNS support – if you want automatic updating of the IP address linked to your domain name
  • Stateful packet inspection (SPI) – no firewall should be without it; used to thwart denial-of-service attacks among others
  • IPsec and PPTP pass-through – if you need VPN remote access to another network
  • NAT plus WPA – for wireless security
  • Web filtering – if you have young kids surfing the net
  • WDS bridging and repeating – if you need to extend the range of your wireless network
  • If none of these buzzwords mean anything to you, here are some reference materials to get you up to speed. Tom’s Networking is a good place to begin your search and product comparison. Another article worth reading is Frank Derfler’s Networking Buyer’s Guide on the PC Magazine web site. While the focus is networking in the workplace, you’ll still pick up a lot of useful information. And, for home networks, don’t miss PC World which has perhaps the most comprehensive comparison of products with some excellent buying recommendations. Even though the article is a little over a year old, most of the equipment is either still available or has been enhanced. In fact, two of their three top-rated products are products we use in our own home networks. PC World’s top-rated wireless router/firewall is now under $30 at Amazon. The retail price of the product when it was reviewed was $110.

    Choosing a firewall/router is only half the battle, of course. And it’s the least important half. Properly configuring the firewall/router is what keeps your network and your server secure. Fortunately, most of the top-rated firewalls come with default settings that provide top notch protection. While there are fairly complete networking guides accompanying most of these products, I would add a few additional recommendations for a home network.

  • 1. Before you do any configuring of the device, load the very latest (stable) updates from the manufacturer’s web site. This is a five-minute task with most of these devices.
  • 2. Don’t configure the router using a wireless network connection. It will only cause you problems. Plug a network cable in to do router configurations.
  • 3. If you choose a wireless model, skip all of the wireless security options except the one which lets you specify the actual MAC addresses of every device which is authorized to use your home network. This option is reliable and provides good wireless network security (see Comments). Every network card has a unique MAC address. No match, no access! You can’t beat that for wireless security. You’re not running a Starbucks with strangers using your network all the time. So hard-code the MAC addresses into your wireless router, and you’ll never have to worry about wireless network security.
  • 4. Open only essential ports for access to your home network from the Internet. If the only thing you plan to do is run a web server, open nothing but port 80. Once you think you’ve got your firewalls configured properly, run Steve Gibson’s free ShieldsUp! port test from inside your LAN to make sure you are secure.
  • 5. Most of these devices come preconfigured to hand out dynamic IP addresses using a DHCP server built into the router. While this is fine for most home networks, it can cause problems if you’re running a web server. The reason is because you must tell the router the IP address to which it should route incoming port 80 (HTTP) traffic, and you want that address to be your web server. Don’t turn off DHCP as the solution to this problem. Instead, let your computer establish a connection to the router and obtain a dynamic IP address. Once it has done this, go back into the router setup with a web browser and enter the MAC address of your Mac mini and its dynamically assigned IP address in the Reserved IP table (usually found under the LAN or Wireless menus with most routers). This tells the router’s DHCP server to always assign this IP address to this machine.
  • 6. Now that your server is going to be on the Internet, we also need to delete the phpinfo() file we built last week to verify that PHP was working. This application displays all sorts of information about your computer including your MySQL password. We don’t have a password to worry about in our configuration, but in the future you might, and then you’d run the risk of exposing it for all the world to see. Using Finder, click on your local hard disk and move to the /Library/WebServer/Documents folder. Then Ctrl-Click on the test4u.php file and move the file to the trash or at least out of your web site directory.
  • 7. Once you complete step 5, it is safe to poke a hole in your firewall (no, not literally!) and map the HTTP service or Port 80 to the internal IP address of your web server (usually done under the Services or Rules menus on most routers). You’ll want to specify that all port 80 traffic be allowed through the firewall all of the time.
  • These tips should get you started. Check back here in a day or two to see if we’ve added anything else. Also take a look at the comments just in case I’ve overlooked something. As you are now beginning to appreciate, this is getting pretty close to Rocket Science, and the more input you get on security, the safer your system will be.

    ISP-In-A-Box: The $500 Mac mini (Chapter VI, The Webalizer)

    You can’t be your own ISP without having some pretty bar graphs and pie charts to impress your friends with how well you’re doing. And no one does them better than The Webalizer. So today we want to add Webalizer to our ISP-In-A-Box and henceforth you’ll have daily statistics for your web site that you can review and analyze ad nauseum. These include summaries of hits, files, pages, and kilobytes for each hour of the day, each day of the week, each URL on your web site, and each entry and exit page of your site plus you get listings of the top referrers to your pages, the top search strings, the top user agents, and totals by Apache response code. Not bad for just installing a free piece of software. Right? Well, not so fast! Webalizer, as it turns out, is one of thousands of little Unix gems sitting out there that is virtually worthless in the current Mac world unless you have a fairly good grasp of Unix because no one has taken the time lately to actually make it work and document what it takes. One would think with all the resources that Apple pours into hardware and software development (not to mention publicity), they could hire just one person to comb through applications (like Webalizer) and clean up the installation routines to keep them up to date with the shipping version of their OS. Alas, we don’t live in a perfect world, do we? The bottom line is that if you simply download the Webalizer package, which incidentally claims to have a Mac OS X installer, it won’t work. So let’s be the good citizens that we are and at least put the pieces together so that it’s usable with Mac OS X v10.3, aka Panther. I’m anything but a Unix guru so you’ll probably want to read the comments to this article (from some real experts) that will tell you all the shortcuts I could have taken if only I had known what I was doing. As they say, you get what you pay for. But, you never know. Some energetic whiz kid may come along and read what we’ve done and decide to automate the whole process with a script. That would be great at least until Mac OS X v10.4 is released. Then we’re back to square one again. See what I mean about having an Apple employee do it.

    Here’s our plan of attack with Webalizer. We’re going to download the Webalizer package and then manually put the pieces where they should go to make things work smoothly. We’ll build a directory off of our main web site to house the daily Webalizer web pages. I’ll provide you a cleaned up configuration file to download and drop in the /etc folder on your server so Webalizer can find it. The config file just tells Webalizer where we’ve put stuff. Then we’ll clean out the old Apache log file and tweak the Apache web server config file to output more detailed logs so that Webalizer can paint pretty pictures for you. After restarting the web server, you’ll have a new Apache log file to support Webalizer. Finally, we’ll introduce crontab and try out our Webmin program from last week to schedule Webalizer to update its data once a day. Then you’ll be able to go to http://localhost/webalizer or your Internet address and look at all the statistical information about your web site whenever you wish.

    Prerequisites. Beginning with this chapter, we’ll list the other ISP-In-A-Box projects you must complete before starting this one. For the Webalizer project, you first must enable the Apache Web Server and at least access one web site on your local machine. This was all covered in our first ISP-In-A-Box installment. You’ll also need to install and activate WebMin to complete the optional crontab portion of this tutorial.

    Obtaining The Webalizer. We’re going to be using Webalizer 2.0-10 which is the current stable version of the software. It’s available from a number of sources. The easiest is probably MacUpdate, but it’s also available for Mac OS X on the Webalizer web site. This software is packaged as a tarball so, once you download it to your desktop, it should decompress into a folder named webalizer-2.01-10-macosx. You also need to download my customized version of the Webalizer config file. Just Control-Click here and Save the Linked File to your desktop as webalizer.conf. Once the download completes, drag it into the Webalizer installation folder to keep things tidy. Now drag the Webalizer installation folder to your Applications folder. We’ll work with it from there. Do not run either of the installation scripts! For those that don’t trust their mother (much less their teacher), here’s what I did with the config file. I started with the sample.conf file which is in the Webalizer download folder. However, it had the wrong Mac location for the Apache log file (which is what Webalizer uses to prepare its charts and data), and we needed a customized web site location to house the Webalizer web pages so I’ve plugged that in as well. If you’d like to look for yourself, open the file with TextEdit, not WorldText. For now, don’t change anything else in the config file, or you’re on your own.

    Apache Housekeeping. As mentioned, we have to do a couple things with the Apache web server to get the most out of The Webalizer. We’re going to modify log file format so that we get more informative statistics. Then we’re going to delete the current log file (actually we’ll rename it so you don’t get too nervous). And finally we will restart the Apache web server which will build us a new log file with the proper format for The Webalizer.

    Open a Terminal window by going to your Applications/Utilities folder and clicking Terminal. Switch to root user access: sudo su. Provide your admin password if prompted. Now let’s move to the directory where the Apache configuration file is stored: cd /etc/httpd. Let’s make a copy of our config file just in case something goes wrong: cp httpd.conf httpd.conf.save. Then you could copy it back if you need to. Now let’s edit the config file: pico httpd.conf. Be careful here! Let’s first find where we need to make our logfile format change: Ctrl-W, logformat, and then enter. Now press the down-arrow key exactly 12 times. You should be at the beginning of a line which reads: CustomLog "/private/var/log/httpd/access_log" common. Insert a pound sign at the beginning of this line by pressing #. Now press the down-arrow key exactly 13 times. You should be at the beginning of a line which reads: #CustomLog "/private/var/log/httpd/access_log" combined. Delete the pound sign at the beginning of this line by pressing Ctrl-D. The # sign should disappear. Now save your changes: Ctrl-X, Y, and press enter.

    We’ve configured Apache to generate log entries in the new format, but we still have a log file in the old format. So let’s rename it. Move to the Apache log file directory: cd /var/log/httpd. Now rename the log file: mv access_log access_log.save. To generate a new empty log file in the new format, we need to restart Apache: Click on the Apple icon in the upper-left corner of your screen, choose System Preferences, and click on the Sharing folder. Uncheck the check box beside Personal Web Sharing and wait for your web server to shut down. Now check the check box beside Personal Web Sharing to restart Apache. Command-Q closes System Preferences. That wasn’t so bad, was it?

    Installing The Webalizer. Now we’re ready to install our Webalizer application. All we need to do is copy the application files to their permanent home and put the Webalizer config file in a place where Webalizer can find it when it runs. Last but not least, we need to create a directory to store our Webalizer web pages which the program will generate each day.

    You should still have a Terminal session with root access open. If not, do it again using the instructions above. Now let’s move to the directory where our installation files are stored. cd /Applications/webalizer-2.01-10-macosx. There are only three files we need to copy to get Webalizer going:

  • mkdir /usr/local (If you get an error, that’s fine. It just means the directory already exists.)
  • mkdir /usr/local/bin (If you get an error, that’s fine. It just means the directory already exists.)
  • cp  webalizer  /usr/local/bin/webalizer
  • cp  webazolver  /usr/local/bin/webazolver
  • cp  webalizer.conf  /etc/webalizer.conf
  • mkdir /Library/WebServer/Documents/webalizer (This sets up a place to store our Webalizer web pages.)
  • To make sure everything works, first open a web browser and go to http://localhost. This will create an entry in your Apache log file.

    Now run Webalizer once in a Terminal window: sudo /usr/local/bin/webalizer

    Switch back to your web browser and go to http://localhost/webalizer/. Wasn’t that easy!

    You can manually run Webalizer as we just did whenever you want to, or you can put an entry in your cron file and have your Mac run it automatically each day. We need to learn about cron files for some future projects anyway so let’s automate the process so your Webalizer statistics are generated once each day.

    First start up WebMin if it’s not already running on your server: sudo /etc/webmin/start. Then open Webmin with your web browser: http://localhost:10000. Now choose System, Scheduled Cron Jobs and then click Create a New Scheduled Cron Job. The form shown above will display. Fill in the form with the values in italics:

  • Execute Cron Job asroot
  • Active?Yes
  • Command/usr/local/bin/webalizer
  • Input to command[leave blank]
  • Command/usr/local/bin/webalizer
  • When to Execute — Times and dates selected below
  • Now look at the bottom section of the form and click on a minute and an hour using a 24-hour clock to designate when Webalizer should be run. Leave All selected for the Days, Weeks, and Months options. You might want to select a time a few minutes from now just to be sure everything works properly. Then you can adjust the time later by clicking on this cron job in the System, Scheduled Cron Jobs web page of WebMin. Once you have chosen a minute and hour, click the Create button to activate the Webalizer cron job. Now access your http://localhost web site several times. Then you can check your Webalizer web site after the time passes to be sure it updated the page hits from your last visits. That’s it for today. Enjoy!

    RSS Made Really, Really Simple

    If the simplicity and headline style of MacSurfer’s Headlines News and Technology News Network leave you wishing there were similar sites to handle your other favorite topics, then you’re ready for Really Simple Syndication, RSS. a lightweight XML metadata format designed to handle headlines and web content. Instead of a single talented company digesting web pages from thousands of providers as MacSurfer does, RSS uses a different paradigm. RSS decentralizes headline-building by encouraging all web providers to create regular "feeds" of their sites containing headlines and content. The content may be the same as the actual web pages, or it may be a subset with links to the complete web pages. Instead of your having to visit hundreds of web sites every day, you use an RSS Reader to do the leg work for you. All you have to do is tell it where to look periodically for items of interest to you.

    Some RSS Readers are free, and some you have to pay for. For the Windows platform, we recommend NewzCrawler. There’s also NewsGator Outlook Edition which, as its name implies, creates RSS feeds in a folder within Microsoft Outlook. For your iPod (Yep, it’s true!), there’s Pod2Go. For your Treo 650 smartphone, there’s mNews. And, for your Mac or Mac mini, no one does RSS better than Ranchero’s NetNewsWire. Free and enhanced versions of Ranchero’s reader are available. The enhanced version is well worth its modest cost. Here’s how it works. Just define the web sites with RSS feeds that you’d like to track and tell NetNewsWire how often to retrieve the feeds. That’s it for the basics. What you’ll see is a 3-pane window (see inset) similar to many email clients. Your RSS sites are listed on the left, the headlines for each site appear at the top right, and the contents (known as an item in RSS parlance) for each story is shown in the bottom right pane. As with good email clients, NetNewsWire remembers which items you’ve read. And the dock icon shows how many unread stories exist in your feeds. You also can import and export your subscriptions for use in other readers, and there’s a Weblog editor which makes quick work of posting RSS content to your favorite blog. NetNewsWire also includes a Sites Drawer. It provides one-click access to hundreds of great RSS feeds. Here’s our own list of favorites in OPML format which can be imported directly into NetNewsWire to get you started. You also can find thousands more on the Complete RSS web site. There’s news, technology, sports, Fark, business and finance, Amazon, programming, humor, tech bargains, opinion, politics, entertainment, sex … well, actually, we just threw that in to see if you still were awake. Finally there are numerous scraped feeds or bootleg feeds. These are third-party crafted RSS feeds of web sites that do not yet (and may never) produce RSS feeds of their own such as WhiteHouse.gov and television program guides. There’s even a site that will create made-to-order RSS feeds for a modest fee. We’ll leave the legal issues these feeds may raise for another day.

    Take a look at what the RSS feed for Nerd Vittles looks like. It’s not much different than the actual web page you’re reading here. Actually, with Complete RSS, it is the web page you’re reading here. NetNewsWire goes one step beyond the Complete RSS approach and actually builds the contents pane from the XML code without reliance on any of the page’s actual HTML code. This obviously facilitates off-line browsing. While RSS content originally was limited to text, all that has changed. You’ll see the same rich content (with images) that you’re used to with a web browser. Just like MacSurfer, the advantage in switching to RSS is that you can comb through hundreds of headlines in just a few minutes rather than waiting for hundreds of web pages (and pop up ads) to load. If you don’t yet own a Mac, there are dozens of other RSS readers available for almost every operating system.

    The latest news in the browser and RSS universe is Firefox 1.0, the web browser that’s taking the world by storm. It supports RSS as an integral part of the browser. And chances are there’s a version for your computer right here. To use RSS within Firefox, just download and install the Sage RSS plug-in. All you need to perfect the reading of most blogs is a simple style file. Just Ctrl-click to download and save ours to your documents directory and configure Sage to use it (Tools, Sage, Options, Settings, Use Custom Style Sheet). Now you’re ready to start saving RSS links to read with Sage and Firefox. We recommend you create a bookmarks folder (Bookmarks, Manage Bookmarks, New Folder) just for RSS links since Firefox can periodically update your feeds. Here’s our RSS feed to get you started. Once you bookmark our link, choose Tools, Sage, and click on Nerd Vittles in your Sage-panel bookmarks folder. Voil√ɬ†!

    Finally, there’s one unsung advantage of RSS feeds over traditional web pages that is huge in our book. With web pages, you never really know when the contents of a page have been updated. And with hit-and-miss web caching, you may not know even when you return to a site. RSS solves this problem transparently. When a page is updated, the link to the page in your RSS feeds list automatically changes back to unread. For those of us that write HOW-TO articles and don’t always get it quite right in version 1.0, RSS provides a great way to alert readers that something important has changed in the story. Give RSS a try, and you’ll see why millions are discovering that it’s a better way to enjoy the web.

    [WM: And here’s one of those updates I was talking about. Another great RSS reader for the Mac platform was released just yesterday. The betas of NewsFire got rave reviews. And, if money matters, it’s half the cost of NetNewsWire.]

    ISP-In-A-Box: The $500 Mac mini (Chapter V, WebMin)

    Today, we were supposed to wrap up our opening series on turning your Mac mini into a full-fledged Internet hosting (or staging) server… but I’ve changed my mind. More than 10,000 visitors showed interest in our articles last week, and more than half of them were from the Windows World. So I’ve decided to continue beating the dead horse a bit longer. We’ll add a couple installments each week until we fill up everyone’s hard disks. You’ll notice we’ve changed from Parts to Chapters. That indicates our intention to continue building on what we’ve already done for some time to come. Think of this as a college class that you don’t have to pay for … or attend, for that matter. And, just like college, we’ll slack off when Spring Fever hits. And, when June rolls around, don’t expect much until next fall. We will wave to you from the beach house, however.

    If you’re just finding our site, you can read the entire series of articles (preferably from the bottom up) by selecting the Internet/Web Category on Nerd Vittles. We also encourage a look around while you’re here. After all, you wouldn’t want your Mac mini to grow up to be just a one trick pony. Our series on Home Automation and Computer Telephony servers can put a Mac mini to good use during those idle cycles. We might even get you interested in photography one of these days, perhaps this summer. And then you can really bore your friends with two nerdy pastimes.

    Coming Attractions. Tomorrow, for Mardi Gras, we’ll be covering RSS, a much better way to keep current with blogs and especially HOW-TO web sites like this one. We’ll tell you why. On Wednesday, we’ll add another chapter to our ISP-In-A-Box series by installing Webalizer, a statistical analysis package with the best bar graphs and pie charts west of the Pecos. On Thursday we’ll address hardware-based firewalls and routers to protect your new system, and we’ll cover all the nitty gritty details to actually get you a domain set up on the Internet so that folks like me can start looking at your web site. If you don’t yet have a web site, don’t worry. We’ll tackle that next week. And then on Friday of this week we’ll have another ISP-In-A-Box feature covering how to install and make quick, free system backups for your Mac mini or any other Mac using any portable USB or Firewire hard disk … even your iPod. And, unlike Windows World, you can test your backup’s integrity by booting your Mac from the remote drive after the backup is complete.

    WebMin, the Ultimate ISP Tool. In days of old, every operating system vendor wrote a proprietary user interface (UI) to make their OS "user-friendly." The trouble was that every time you switched operating systems, you had to learn an entirely new UI, too. Jamie Cameron changed all of that with the introduction of WebMin. If you have any previous experience with almost any flavor of BSD, Linux, IBM AIX, Sun Solaris or Java Desktop, then today’s topic will not be news to you. WebMin is one of the must-have tools on almost every server platform. What PhpMyAdmin did for MySQL, WebMin does for virtually every open source application in the marketplace. It provides a web front-end to manage almost everything running under the hood of your machine including cron jobs, bootup and shutdown processes, system logs, DNS, SSH Server, Apache web server, Postfix SMTP server, MySQL, PostgreSQL, NFS, SSL, Perl, and SAMBA to name a few. If you want to host multiple domains on a single server with Apache (including a Mac mini), nothing can come close to WebMin for quick, reliable, and automatic Apache configuration. As was true with PhpMyAdmin, powerful tools pose powerful risks if (1) you don’t know what you’re doing or (2) you don’t consider security before installation. WebMin includes its own web server which runs on port 10000 by default. You either need to enable the firewall on your Mac mini and leave port 10000 closed or you need to install a firewall/router between your Mac mini and the Internet and leave port 10000 closed. This will assure that no one can get to WebMin except sitting in front of your machine. And you’ll still need a username and password to get in. That’s about as secure as life gets these days. So let’s begin the installation.

    First, we need to download the WebMin software. Go to prdownloads.sourceforge.net/webadmin/ and scroll to the bottom of the list. We want to download the latest and greatest version which includes support for Mac OS X v10.3: webmin-1.180.tar.gz. If you’re reading this months from now, there may be a later one. If so, get it in the tar.gz format. Choose a mirror close to you and download the file to your desktop. Once the file has been downloaded, it will decompress in a couple minutes into a folder with the same name as the original file: webmin-1.180. At the present time, there are 182 items in the folder. Your mileage may vary if a new version comes out down the road. Now drag the entire folder to your Applications folder.

    We’ll need to get our hands dirty a little bit to complete the installation so just follow along and don’t get ahead of us. Go to the Applications/Utilities folder and open a Terminal window. Type sudo su and press enter. If prompted, type your admin password to switch to root access. Now move to the webmin installation folder: cd /Applications/webmin-1.180. Start the installation script by typing ./setup.sh and press enter. Don’t forget the leading period! You’re now going to be asked a series of questions. Listed below are the questions (in bold) followed by the corrrect answers (in italics) for you to provide:

  • Config file directory /etc/webminpress enter
  • Log file directory /var/webminpress enter
  • Full path to perl /usr/bin/perlpress enter
  • Web server port (10000)press enter
  • Login name (admin)press enter
  • Login passwordtype your admin password and press enter
  • Password againtype your admin password again and press enter
  • Start Webmin at boot timetype y and press enter
  • The installation script then will whirrr away for a minute or two. Be patient! WebMin will then tell you it’s finished and give you a couple little pieces of information that you need to either write down or bookmark this page.

  • To uninstall WebMin, open a Terminal window, sudo su, provide admin password, and run this script: /etc/webmin/uninstall.sh
  • To manually stop WebMin, open a Terminal window, sudo su, provide admin password, and run this program: /etc/webmin/stop
  • To manually start WebMin, open a Terminal window, sudo su, provide admin password, and run this program: /etc/webmin/start
  • To access WebMin with a web browser, go to http://localhost:10000 or http://127.0.0.1:10000 or http://nnn.nnn.nnn.nnn:10000 where nnn.nnn.nnn.nnn is your Mac’s IP address
  • Now we’re ready to see if things are working properly. Open a web browser and go to one of the addresses above. You should be prompted for a username and password. Type admin for your username and type your admin password. Don’t save it … but you knew that! You should see the WebMin opening page. Now that wasn’t so bad, was it?

    WebMin WARNING: WebMin has a deceptively simple user interface, and you may be tempted to muck around and improve things. Don’t … until you first RTFM (read the manual)! Or go to your favorite bookstore and thumb through a few of the many great books on WebMin. Pick one that best suits your reading style. They all pretty much cover the territory.

    WebMin Housekeeping. WebMin updates are released periodically. You can get on the mailing list at webmin.com. Once you know of an update, here’s the process to get it and install it. Nothing could be simpler. Open WebMin with your web browser. Go to Webmin, Webmin Configuration, Upgrade Webmin. Move to the third form on the page which is labeled Update Modules Now. Run the test to see what you’re missing by leaving the defaults and clicking the Update Modules button. WebMin will then check for updates and tell you what you’re missing. Go back to the Update Modules section again, uncheck the "Only show …" option and check the "Install Modules …" option. Then click the Update Modules button again. The new modules will be installed. You’ll need to do this once after this install because there is at least one update available. If you don’t get on the mailing list, then you need to go through this drill about once a month. I would not turn on the automatic updates. If the WebMin update server gets compromised, you are toast!

    Finally, a word about whether to run WebMin all the time. If you have a gig of RAM, it won’t hurt. With anything less, I would turn it off until I needed it. That means you probably don’t want it to start up when you boot your machine. You then can manually start it with the command shown above. Here’s how to disable the automatic boot of Webmin. Open WebMin in your browser. Go to System, Bootup and Shutdown, and click on WebMin in the alphabetical list. Change the startup setting from -YES- to -NO- and click the Save button. That should get you started with WebMin.

    Vindication At Last: ISP-In-A-Box Performance. Privately, I’ve caught more than a little grief from colleagues suggesting that the Mac mini really isn’t up to snuff to handle some of the tasks we’ve been throwing at it this past week. Well, the testing results are in comparing a Mac mini to a 1.8GHz dual-G5 using the industry-standard Apache Bench application. According to Macminicolo.net, which handles colocation services for servers of all flavors, "While [Mac mini] figures aren’t at the top end of the generally available ISP-class web server performance curve by any means, the economics of the Mac mini are such that for the first time ever there is a competitive Macintosh server able to handle more than 1000 hits per second yielding 20Mbits of data at a price that meets or beats much of the industry…"

    PHP/MySQL Book List. I promised last week to put together a reading list to get you started with PHP and MySQL. There are a number of books that cover both topics together which is a good way to learn PHP and MySQL. My favorite is PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide by Larry Ullman. There’s also a little more advanced O’Reilley book on the subject: Web Database Applications with PHP & MySQL, 2nd Edition. You can’t go wrong with either one, or just buy them both and skip that romantic dinner out next week. Heh heh heh.