LJ Archive

An alternative to the CERN http daemon is the National Center for Supercomputing Application's http daemon which is designed to be small and fast.

Connect by anonymous FTP to ftp.ncsa.uiuc.edu and look in directory /Web/httpd/Unix/ncsa_httpd/httpd_1.3. Or ftp to sunsite.unc.edu and look in /pub/packages/ infosystems/WWW/servers/ncsa_httpd/httpd_1.3. In binary mode, retrieve the file httpd_source.tar.Z.

You can put this file anywhere you want; perhaps /usr/src/ncsa. When you uncompress and untar this file, it will put its contents into a httpd_1.3 subdirectory.

You may need to plug a recently-discovered security hole. ftp to cert.org, and mget /pub/ncsa_advisories/CA-95:04*. Perform the two simple source-code changes called for, if they have not already been made in the official source.

Now is a good time to think about where the installed files will go. Make a directory /usr/local/etc/httpd, and under it make three subdirectories: conf, htdocs, and logs. Set their access permissions in accordance with your machine's security policy. We'll populate these directories shortly.

Return your attention to the /usr/src/ncsa/httpd_1.3 directory. cd src and edit the Makefile. Not much in this file requires changing. You'll see a nice selection of AUX_CFLAGS lines for various architectures. Find the line with

-DLINUX and uncomment it. You may add -m486 to this line if you'd like your httpd to use 486-specific optimizations, but it's not necessary.

Save the Makefile and do a make. You will need to have obtained a C compiler, probably gcc, and recent libraries. I used gcc 2.5.8 and libc.so.4.5.26, and httpd built and ran unmodified.

Move the resulting httpd executable to /usr/local/bin.

Now it's time to look again at /usr/local/etc/httpd. You need to copy files out of /usr/src/ncsa/httpd_1.3/conf into /usr/local/etc/httpd/conf. Make sure to copy mime.types, srm.conf, httpd.conf, and access.conf, removing the -dist suffix from their names as you do. The only one of these which requires modification is httpd.conf, which is the overall configuration file. Double-check that ServerType is set to standalone in httpd.conf; this means that httpd will be started on its own, rather than by inetd. You should also put in your e-mail address as the value for ServerAdmin, and fill in the name of this machine as ServerName.

The file srm.conf controls the name space that clients see when they connect to your server. The file access.conf manages global access control. Finally, mime.types tells your server how to map filename extensions to MIME document types. (This is not to be confused with the .mailcap file Web clients use to map MIME document types to external viewer programs.) None of these three files require modification.

Your http daemon will fill your /usr/local/etc/httpd/logs directory with useful access logs (useful if your site is running DNS, anyway). Make sure that the directory exists, or the logs will not be kept.

The fun directory is /usr/local/etc/httpd/htdocs. This is where you put your HTML documents and the hypermedia excitement they point to. Call your top-level document index.html, so clients don't have to remember a dumb filename at the end of your site's URL. Remember, the best URL is one nobody needs to write down.

Time to start your daemon! Just do this:

/usr/local/bin/httpd

You'll need to do this as root if you are providing http service at the default port (80), but your daemon will still run with the user identity specified in httpd.conf.

Put some code in one of your startup scripts, such as /etc/rc.d/rc.local, to restart the daemon when you reboot:

if [ -x /usr/local/bin/httpd ]; then
/usr/local/bin/httpd
fi

The file http_docs.tar.Z on the FTP archives contains lots of HTML-formatted documentation, which you'll need for advanced topics like CGI setup or fancy directory listings.

That's all! Now you can go back and customize if necessary by re-editing the configuration files. If you do, remember to restart the daemon by sending it a hangup signal, killall -HUP httpd.

Brian Rice is Member of Technical Staff with K Computing, a nationwide Unix and Internet training firm.
LJ Archive