Data Centers

Configuring Apache with Mohawk

You run a farm of Web servers that are all critical to your company. You use Apache because, well, it makes sense. You also need to configure Apache quickly. Is Chilliware's Mohawk the tool for you? Read on, as Vincent Danen helps you to decide.


In this Daily Drill Down, I’ll take a look at installing and using the Mohawk Apache Server Configurator from Chilliware. You can download a demo of Mohawk from Chilliware after completing a form that asks for some personal information and accepting their license agreement. Alternatively, you can download the demo from their FTP site. Mohawk retails for $79.95 from the Chilliware online store.

A bit of introduction
According to the latest Netcraft Web Server Survey, done in December 2000, the Apache Web server is the most popular Web server on the Internet today. Of all Web sites surveyed, the percentage that was running Apache was 60.04 percent, and the actual number of Web servers was over 15.4 million. In second place was Microsoft-IIS with 19.57 percent and an actual server count of over 5 million.

The first graph on the survey page is very interesting. It shows a dramatic rise in the number of servers using Apache that continues to rise amid a few declines. Considering where it was in 1995 compared to where it is now, Apache is clearly the fastest growing and most popular Web-serving software available.

The reasons for this are simple: It runs on most operating systems, it's open source and free, it's in constant development, and it's stable. All of these factors together make Apache a very appealing choice for systems administrators the world over.

If you run your own Web site, chances are you’re using Apache. If you’re considering setting up a Web server, chances are you’re looking at Apache. And if you use Linux, chances are you already have Apache.

Consider Compaq, which recently switched from using Microsoft-IIS under Windows NT to using Apache under Compaq Tru 64 UNIX. Amazon.com runs its Web server under Linux using Apache. There are even rumors that Wal-Mart’s Web server is using Apache masqueraded as a Microsoft-IIS server.

It's amazing to see the unprecedented growth in the use of Apache as a Web server in the last five years. This exponential growth suggests that if you are looking to use Web server software, you may want to go with the majority choice. After all, if over 15 million Web servers on the Internet are using Apache, there must be something good about it.

Because of this widespread use, a number of programs developed for Apache have appeared. Since Apache uses a text file type of configuration file that can be daunting to the new user, most of these programs try to make configuring Apache easier and a little more user-friendly. Some of these programs are open source and free, such as webmin and the Apache Toolbox. Others are commercial and require you to purchase the closed-source software. One of the latter is Chilliware's Mohawk program.

Mohawk is a Qt-based configuration program for Apache, which means that you will need the Qt libraries installed. If you use KDE, you already have them installed. The stated requirements for Mohawk are a Pentium 200 processor (minimum), 16 MB of RAM (64 MB recommended), 50 MB of hard drive space (150 MB recommended), a Linux kernel of 2.2.x or higher, a CD-ROM drive, Qt 2.0 or higher, and an X server. All of this equipment is standard on most Linux servers.

Installation
Installing Mohawk is very simple. Simply mount the CD-ROM and change to the mount directory, as shown here:
mount /mnt/cdrom
cd /mnt/cdrom


You have a choice of how to install Mohawk. For the RPM-based distributions, you should install the Mohawk RPM. To do this, run the install.sh program as root in the install/RPM/ subdirectory, like this:
cd install/RPM
./install.sh


Alternatively, if you run a non-RPM distribution such as Debian or Slackware, you can change to the install/BIN/ subdirectory and also execute the install.sh program as root. This directory contains TAR GZipped archives instead of RPM packages that will work on all non-RPM distributions.

You may get a Permission Denied error on the install.sh file. On the CD-ROM I have, the install.sh file is not executable, which makes little sense. However, it is easy to get around this problem. You can execute the following command instead to run the installer:
sh install.sh

If you download the demo version, simply install the RPM package using
rpm -ivh Mohawk_demo_stat.i386.rpm

Once you have installed Mohawk, execute it as root. Mohawk will not run as any other user because it does not have the required write access to your /etc/httpd/conf/httpd.conf file. Therefore, Mohawk is useful only for systems administrators and not general users.

Before you run Mohawk, I highly recommend that you back up your entire /etc/httpd/conf directory, just in case Mohawk makes any undesirable changes to your configuration and you need to get it back the way it was. Execute the following commands to make a backup of your configuration directory:
cd /etc/httpd
cp -av conf conf-org


This will create a new directory called /etc/httpd/conf-org/, which will contain your current Apache configuration files.

Using Mohawk
To run Mohawk, simply type mohawk at the command line. The program will install to your /usr/bin directory, which should be on your PATH, so you will not need to do anything fancy to run it.

If you have problems running Mohawk, it might be because the installer decided to install the dynamically linked binary package instead of the statically linked package. If this is the case, simply remove the dynamically linked package and install the static package by executing these commands:
rpm -e Mohawk
rpm -ivh Mohawk-1.03-00120_stat.i686.rpm


Also, if you typically use X as a user other than root, you may have difficulty running Mohawk. Typically, you would open an xterm and su to root to execute Mohawk. If this does not work, open another xterm, and as the user you are currently logged into X as, type
xhost +

This will disable access control and allow the root user to connect to your X server. Now, you can run Mohawk.

The first thing you must do is select the httpd.conf file to edit. By default, the file is /etc/httpd/conf/httpd.conf. If this is not the file that your copy of Apache uses, simply change the name of the file to the appropriate one.

Once you have selected the appropriate configuration file, you will be shown Mohawk's main screen. This screen is a tree view of the Web server(s) you have made Mohawk aware of. The Default Host configures the default settings of Apache. If you expand the Default Host, you will see a little house icon with a forward slash (/) behind it, indicating the root-level directory. If you expand this directory, you will see subdirectories such as icons, cgi-bin, and so on, depending upon how your Apache system is configured.

You can also switch between Logical and Physical views. The Logical view shows directories and files in the Apache hierarchy, with the root directory being the Web root directory. The Physical view shows you the directories and files in relation to the Linux file system, and therefore the root directory will appear as /var/www or /home/httpd, depending on how your Web root directory is configured.

At the top of the screen, you will see a few pull-down menus named File, Server, and Help. The File menu allows you to save the current Apache configuration, print it out, or exit Mohawk. The Server menu allows you to start, stop, and restart the server, as well as obtain the server's current status and do a quick syntax check on the configuration file. Finally, the Help menu shows you the startup splash screen if you select About.

If you right-click any given directory, you will be given a rather overwhelming set of options to configure. Right-click the root directory in the tree view and then select the Properties button.

You will see a new window showing the path to your server's base HTML directory. In my case, it is /var/www/html. You will also see a number of tabs, including Meta, Limits, Authentication Config, Override Settings, and more. Each of these tabs opens a new screen for configuring the directory in which you’re currently operating.

If you go through each of these tabs, you will see an impressive—and somewhat confusing—list of options you can configure. Many of these may not make much sense to you at first glance, and unless you’re experienced with Apache's great range of options, many of them may seem like nothing special to you or too foreign to experiment with.

Mohawk has a neat tooltips feature. If you click the arrow icon with the question mark at the bottom of the window, it will turn on the context help for the next selected item. If you click the icon and then click a configuration setting, you will see a pop-up window detailing what that option does.

This is the only source of help you will receive from Mohawk. How things interoperate is left to you. You will have to research how Apache works and the best way to accomplish your needs by looking at the Apache documentation. If you purchase Mohawk, you will receive the Apache 1.3 documentation in PDF format in the docs/ directory on your CD-ROM. While the tooltips are handy for a quick refresher on certain configurable items or to let you know what a certain item is good for, you may find it necessary to at least browse the documentation.

Let's take a look at the options you will probably configure most often. On the Options tab, you can define some of the controls for various directories. Here you can determine which options will operate on the currently selected directory. For instance, you can turn on or off the ability to execute CGI scripts, choose whether or not to follow symlinks, and so on. These options are configured in Apache's <Directory></Directory> sections.

The Templates tab lets you define some templates for HTTP response headers and errors. This is a good place to define special error messages for common errors such as 404 (Page Not Found).

The Authentication Config tab lets you define .htaccess definitions. You can define all aspects of the .htaccess files here, including anonymous authorization, verifying the e-mail address of anonymous connections, what files and directories are used for authentication, and so forth.

The Limits tab lets you define the Allow/Deny directives for the current directory. With this option you can limit access to the directory to certain IP addresses or domains or allow free access to the directory.

You can also add or remove directories from the tree view. Adding a new directory allows you to specify the full path to the directory as well as the alias to be used within Apache. Mohawk does not create the actual directory for you—that is one step you’ll need to do yourself. But this is where you can make Apache aware of new directories you’ve added to the Web tree.

Finally, if you right-click the WWW Servers line, which is the top-level directory of the left-hand tree view, you can add new virtual hosts to your configuration. You can define IP-based or domain name-based virtual hosts here. If you define a domain name-based host, you’ll need to select the Name Based Host check box so that Apache knows to listen to the default IP address. You can also specify the port for the new virtual host to listen to as well.

You will be asked to specify the domain name and any server aliases that it should respond to. For example, if your virtual host is otherdomain.com, you might enter otherdomain.com as the virtual host and www.otherdomain.com as a server alias. You will also need to define the server path, which might be something like /var/www/otherdomain.com/html. Once you’ve finished configuring the virtual host, it will be listed on the tree view below the default host.

Also, if you right-click the WWW Servers top-level directory in the tree view, you’ll see a few more global configuration options. Here you can define the number of processes that can run at the same time, the modules loaded by Apache, and various environment settings dependent upon client browsers. You can also define the special files and directories for Apache, such as the PID file, lock file, and the server directory, under the Server Config tab. Here, you can also tell Apache which IP addresses and ports to listen to and even which IP address to bind to if you want it to listen to only one address. Finally, you can configure whether or not Apache should be run as a stand-alone server or whether it should be run from inetd.

Other features
The Mohawk CD comes with a few other goodies to let you make the most of Mohawk and your Web-serving experience. In the deps/ directory on the CD-ROM, you will find the Apache Web server itself and the Qt libraries required to run Mohawk. If you didn't have either installed before installing Mohawk, you can install them right from the CD.

In addition, the contribs/ directory contains other items, such as StarOffice 5.2, the GIMP, the BlueFish HTML editor, and the Mozilla and Netscape Web browsers for Linux. It also contains the BRU backup program, which is an excellent backup program for tape drives.

Finally, in the chillistuff/ directory, you will find demos for two other Chilliware products: Mentor and iceSculptor.

So although the price for Mohawk is, in my opinion, a little steep, you do get some extra products besides Mohawk itself. With the products that come with Mohawk, you don't need anything beyond the hardware to run it and the X server to use it. Everything else required for Mohawk is included.

Conclusion
In this Daily Drill Down, we looked at installing and using the Mohawk Apache Server Configurator from Chilliware. While Mohawk is a nice GUI interface to the Apache Web server, it could be cleaned up a little so as not to seem so overwhelming. There is too much crammed into one place, and that might confuse people new to Apache. Although this abundance of tools demonstrates the power of Apache, it could have been organized a little better.

One problem I really noticed is that it does not seem to support Include directives, which is frustrating, especially for anyone who has been using Apache for a while. Most people who use Apache make extensive use of Include directives, especially if they are doing virtual hosting. Mohawk supports virtual hosting but does so in a different way by throwing everything together into one file. This will cause problems for people using Includes, which is one reason I specifically mentioned backing up your httpd.conf file. I learned this lesson the hard way.

All in all, Mohawk is a pretty nice program, and I do recommend it. Existing Apache users just need to be careful about how they use it—and remember to back up their existing configuration!
The authors and editors have taken care in preparation of the content contained herein but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes.

About Vincent Danen

Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.

Editor's Picks