Someone recently asked me to help them install a Web server on her Linux system. I simply pointed her Web browser at http:// localhost, and up came a "Test Page" from Red Hat's Apache package, displaying the banner "It worked!"
The point is that most Linux distributions already include the Apache Web server package and will install it either by default or through a simple selection from the installation scripts. So if you have installed Linux, no additional work is required to install a Web server; you've already done it.
It sometimes happens, however, that your distribution may not have included the particular Web server you want to use. Or you may want to upgrade an existing Web server to a newer version. In that case, you may have to install one of the many Linux Web server packages using your distribution's package management facilities, or by grabbing a tarball of the Web server's sources, compiling them, and installing them manually.
There is not enough space to go into great detail on these alternatives. Fortunately, even a manual package install is rather simple. To install a new Web server package from an RPM file, you would use a command like:
rpm -i
apache-1.3.3-1.i386.rpm
Similar commands would be used on Debian and Slackware systems, which each have their own package management commands.
In the most basic case, running a Web server under Linux is simply a matter of providing some HTML files (some Web pages). In other words, you can just drop your Web pages into the DocumentRoot directory. That's usually located in /home/ httpd/html, and it's always definedin the Web server's configuration files. Those configuration files are usually located in /etc/http/conf. You can generally find your DocumentRoot using a command like:
grep -i documentroot \
/etc/httpd/conf/httpd.conf
Once you've found or re-defined your DocumentRoot, you can focus on composing your content using any HTML or plain text editor. Netscape Communicator's Page Composer and AdvaSoft's asWedit are a couple of popular HTML editors that run under Linux. The HTML editors perform syntax checking and generally make it easier for the novice to write valid HTML. Keep in mind that HTML is really just normal text, so any text editor, such as emacs or vi (my personal favorite) work just as well.
Creating content is the most important aspect of running any Web server, regardless of what platform you run it on. Also keep in mind that good writing is hard work. Many webmasters get so caught up in the latest Web fads, expending much of their effort building and maintaining elaborate Web-based applications, that the basics of well-written content are often forgotten.
Active Content
Although I think that good Web sites should be based on solid foundations of well-written content, most good sites also have at least some "active" content.
The traditional CGI (common gateway interface) and SSI (server-side includes) mechanisms are the most well known and widely supported methods for generating dynamic Web pages and for interacting with users, (generally through HTML forms). There are many "canned" CGI scripts available on the Web. The best places to look for them are at Matt's Script Archive at http//www.worldwidemart.com/ scripts/ and, since most CGI programming is done in PERL, at the CPAN (the Comprehensive PERL Archive Network of ftp and Web mirrors) at http//www.cpan.org or http: //reference.perl.com/query.cgi?cgi.
In addition to the traditional SSI, Apache supports XSSI (an extended SSI), PHP3 ("personal home page"), embPERL, and other server-driven scripting languages.
All of these server script interpreters work by reading source files, usually a combination of HTML intermixed with programming statements. They execute the embedded scripting commands and may insert additional HTML into the contents of the file as it is sent to the browser, which has requested a given URL. The resulting effect can be as simple as any of those ubiquitous "hit counters" and as elaborate as anything that your Web browsercan possibly display.
The Apache Web server doesn't include all of the different programming languages by default, however. That would bloat the installation unnecessarily since few Web masters use more than a couple of these languages in their Web pages anyway.
Also, Apache is modular -- you can compile literally hundreds of modules into your Web daemon. In addition, new versions of Apache support DSOs (dynamic shared objects), which are conceptually similar to Linux loadable kernel modules, and can be loaded by Apache without recompilation. This is far more convenient than the old "rebuild" method, making Web server configuration much easier for those users unfamiliar with source compilation. There's even an Apache module that checks "bad" URLs for common misspellings before returning one of those infamous "404 File not Found" errors.