-->
Previous | Table of Contents | Next |
Whether you compiled the Apache daemon httpd yourself or it was supplied ready-to-go with a Linux CD-ROM, you now have to set up the configuration file which is usually called httpd.conf. Under the Apache directory there should be a subdirectory called conf. Inside this directory should be three configuration files called srm.conf-dist, access.conf-dist, and httpd.conf-dist. These files have to be copied to new filenames using these commands:
cp srm.conf.-dist srm.conf cp access.conf-dist access.conf cp httpd.conf-dist httpd.conf
Use any ASCII editor and open httpd.conf. The httpd.conf file contains general information about your server such as which port to use, the username to run as, and so on. Most of the information will be fine the way it is, but you can customize it if you want. Next, open srm.conf which is used to set up the document tree for the home pages as well as special HTML instructions. Again, most of the settings will be fine. Finally, the access.conf file is used to set the base levels of access to the system, and you can edit that to suit your needs or leave the default values.
TIP:
Apache supplies three configuration files by default but it doesnt need to have three. In fact, its often easier to do just that for convenience in customizing and configuring Apache. If you do use a single file, the file httpd.conf is the one to use. To tell Apache to ignore the access.conf and srm.conf files and place these commands in the httpd.conf file:AccessConfig /dev/null ResourceConfig /dev/null Delete the two files access.conf and srm.conf from the directory.
To start httpd with the configuration files youve prepared, use this command:
httpd -f path/httpd.conf
The path above should be the full path to your httpd.conf file. The -f option tells httpd where to read the server configuration file. This will start the httpd server daemon, which you can verify with the ps command.
Youve seen one of the httpd command flags above. There are only a few flags involved with the httpd command. These are:
-d | specifies the document root directory |
-f | specifies the server configuration file |
-h | lists directives in force (from the Configuration file) |
-v | shows the version number |
-X | for debugging |
A few other flags are added with each new release of Apache, but most are not used except for tweaking the systems behavior or debugging. For a full list of flags, enter the command
httpd -?
Or check for a man page or the documentation available from the apache.org Web site under the /docs directory.
To make things simple lets assume you want to use Apache to act as the server for your local area network. Machines on your network will use a browser to log into the Apache server for Web pages. This simple example shows how to set up Apache for a straightforward network and can be modified slightly for a Web server to the Internet.
We start by setting the root directory for the Web server. Lets assume were setting up for a network called darkstar. The convention used by Apache is to call this site.darkstar. The configuration files for site.darkstar will be in a conf directory under the site.darkstar directory (such as /usr/web/site.darkstar/conf).
Set the document root directory for the site with the -d option of the httpd command:
httpd -d /usr/web/site.darkstar
All of your documents for the Web site should reside in the documentation root directory and subdirectories. For this youll need HTML coding.
Theres a lot more to Apache that lets you customize the server considerably but doing so is a little time-consuming and would take a hundred pages to explain. If you want to learn all there is to know about Apache, read the documents on the apache.org site or pick up one of the Apache books on the market.
Setting up your home page requires you to either use an HTML authoring tool or write HTML code directly into an editor. The HTML language is beyond the scope of this book, but you should find several good guides to HTML at your bookstore. HTML is rather easy to learn. With the information in this chapter, you should be able to set up your Web site to enable anyone on the Internet to connect to you. Enjoy the Web!
From here you can move to a number of different chapters depending on the type of information you are looking for. To learn about:
Previous | Table of Contents | Next |