The httpd.conf file (to be found in ... /site.first) contains the following:
User webuser Group webgroup ServerName localhost DocumentRoot /usr/www/site.first/htdocs TransferLog logs/access_log
In the first edition of this book we mentioned the directives AccessConfig and ResourceConfig here. If set with /dev/null (NUL under Win32), they disable the srm.conf and access.conf files, and were formerly required if those files were absent. However, new versions of Apache ignore these files if they are not present, so the directives are no longer required.
If you are using Win32, note that the User and
Group directives are not supported, so these can
be removed.
Apache's role in life is delivering documents, and so far we have not done much of that. We therefore begin in a modest way with a little HTML script that lists our cards, gives their prices, and tells interested parties how to get them.
We can look at the Netscape Help item "Creating Net Sites" and download "A Beginners Guide to HTML" as well as the next web person, then rough out a little brochure in no time flat:[24]
[24]See also HTML: The Definitive Guide, by Chuck Musciano and Bill Kennedy (O'Reilly & Associates).
<html> <h1> Welcome to Butterthlies Inc</h1> <h2>Summer Catalog</h2> <p> All our cards are available in packs of 20 at $2 a pack. There is a 10% discount if you order more than 100. </p> <hr> <p> Style 2315 <p align=center> <img src="bench.jpg" alt="Picture of a bench"> <p align=center> Be BOLD on the bench <hr> <p> Style 2316 <p align=center> <img src="hen.jpg" ALT="Picture of a hencoop like a pagoda"> <p align=center> Get SCRAMBLED in the henhouse <HR> <p> Style 2317 <p align=center> <img src="tree.jpg" alt="Very nice picture of tree"> <p align=center> Get HIGH in the treehouse <hr> <p> Style 2318 <p align=center> <img src="bath.jpg" alt="Rather puzzling picture of a bathtub"> <p align=center> Get DIRTY in the bath <hr> <p align=right> Postcards designed by Harriet@alart.demon.co.uk <hr> <br> Butterthlies Inc, Hopeful City, Nevada 99999 </br> </HTML>
"Rough" is a good way to describe this document. The competent HTML person will notice that most of the </P>s are missing, there is no <HEAD> or <BODY> tag, and so on. But it works, and that is all we need for the moment.
We want this brochure to appear in ...
/site.first/htdocs, but we will in fact be using it in
many other sites as we progress, so let's keep it in a central
location and set up links using the Unix
ln
command. We have a
directory /usr/www/main_docs, and this document
lives in it as catalog_summer.html. This file
refers to some rather pretty pictures that are held in four
.jpg files. They live in ...
/main_docs and are linked to the working
htdocs directories:
% ln /usr/www/main_docs/catalog_summer.html . % ln /usr/www/main_docs/bench.jpg .
The remainder of the links follow the same format (assuming we are in
.../site.first/htdocs).
If you type ls, you should see the files there as
large as life.
Under Win32 there is unfortunately no equivalent to a link, so you
will just have to have multiple copies.
Type ./go and shift to the client machine. Log onto http://www.butterthlies.com /:
INDEX of / *Parent Directory *bath.jpg *bench.jpg *catalog_summer.html *hen.jpg *tree.jpg
What we see in the previous listing is the index that Apache concocts in the absence of anything better. We can do better by creating our own index page in the special file ... /htdocs/index.html :
<html> <head> <title>Index to Butterthlies Catalogs</title> </head> <body> <ul> <li><A href="catalog_summer.html">Summer catalog</A> <li><A href="catalog_autumn.html">Autumn catalog</A> </ul> <hr> <br>Butterthlies Inc, Hopeful City, Nevada 99999 </br> </body> </html>
We needed a second file (catalog_autumn.html) to make the thing look convincing. So we did what the management of this outfit would do themselves: we copied catalog_summer.html to catalog_autum.html and edited it, simply changing the word Summer to Autumn and including the link in ... /htdocs.
Whenever a client opens a URL that points to a directory containing the index.html file, Apache automatically returns it to the client (by default; this can be configured with the DirectoryIndex directive). Now, when we log in, we see:
INDEX TO BUTTERTHLIES CATALOGS *Summer Catalog *Autumn Catalog -------------------------------------------- Butterthlies Inc, Hopeful City, Nevada 99999
We won't forget to tell the web search engines about our site. Soon the clients will be logging in (we can see who they are by checking ... /logs/access_log). They will read this compelling sales material, and the phone will immediately start ringing with orders. Our fortune is in a fair way to being made.
Copyright © 2001 O'Reilly & Associates. All rights reserved.