Chapter 17
HTTP: Hyper Text Transfer Protocol
|
|
|
|
|
![](gif/black.gif) |
In this chapter: |
|
|
|
![*](gif/bullet.gif) ![](gif/clear.gif) |
Examining HTTP server software on Apache
|
![*](gif/bullet.gif) ![](gif/clear.gif) |
Locating the different document trees for the system and user pages
|
![*](gif/bullet.gif) ![](gif/clear.gif) |
Finding more information
|
|
|
|
![](gif/black.gif) |
|
HTTP is the protocol used for Web surfing. Even if it is one of the
younger branches of the TCP/IP protocol family, it's the one that made
the Internet popular and useful for lay people. SuSE ships the world's
most popular HTTP (Web) server, Apache, with its distribution. Apache
is a derivative of the NCSA (National Center for Supercomputing
Applications, University of Illinois, Urbana-Champaign) Web server,
and started as a set of patches (A patch e) for this server. At a
certain point, the providers of these patches formed a group of their
own and1 released the first version, Apache 1.0, in December 1995.
|
![NOTE](gif/icon_note.gif) |
You can find the history of Apache and an extensive set of
documentation on the Web site of the Apache group at
http://www.apache.org.
|
|
Apache has so many configuration options that even a brief
introduction is beyond the focus of this book. SuSE's details on
preconfiguring the server cover most of the standard features, and the
server starts without incident with even a basic SuSE Linux
installation. Apache uses five configuration files, located in
/etc/httpd. The access.conf,
httpd.conf, and srm.conf files are the main
configuration files, holding all directives that control the server's
behavior. There is no real reason to have three files. The directives
are split up mainly for historical reasons and to separate different
aspects of their duties into different files. The file magic holds
data for the mod_mime_magic Apache module that is used to
determine file types. Closely related to this issue is the definition
of the MIME (Multipurpose Internet Mail Extensions) types in
mime.types.
|
17.1 | Walking through the document tree |
|
The root directory of the document tree is set to
/usr/local/http. SuSE provides a standard start page and
links to online documentation as default documents. If you want to use
your machine as a plain intranet or Internet server, this is the
directory tree you have into which to put your documents, CGI
scripts, or both. There is almost no need to change the configuration
if you don't need any special features. The directory
/usr/local/http has four subdirectories.
|
17.1.1 | htdocs |
|
This is where the html pages are stored. The file
index.html represents the homepage of the server. You can
create subdirectories, put more html pages into this directory, or
both.
|
![CAUTION](gif/icon_caution.gif) |
Everything in this tree will be accessible via HTTP if it's readable
for the Web server. The server has the permissions of user
wwwrun and group nogroup. So please make
sure that all files you want to provide via the Web are readable by
this user.
|
|
|
17.1.2 | cgi-bin |
|
Directory for CGI scripts. There are a few sample CGIs in this
directory. Most useful is test.pl. It prints the server
environment if you call it in a Web browser.
|
![TIP](gif/icon_tip.gif) |
Try to load the page
http://localhost/cgi-bin/test.pl. You will get something
like this, which shows you all information about your server:
|
| Date: Sun Feb 21 11:23:34 1999
%ENV:
SERVER_SOFTWARE = Apache/1.3.4 (Unix) SuSE/6.0 PHP/3.0.6 mod_perl/1.17
DOCUMENT_ROOT = /usr/local/httpd/htdocs
GATEWAY_INTERFACE = CGI-Perl/1.1
UNIQUE_ID = NtBdNcCoAMQAAADoIj8
REMOTE_ADDR = 192.168.0.66
SERVER_PROTOCOL = HTTP/1.0
SERVER_SIGNATURE = Apache/1.3.4 Server at Homer.suse.com Port 80
REQUEST_METHOD = GET
QUERY_STRING =
HTTP_USER_AGENT = Mozilla/4.5 [en] (X11; I; Linux 2.2.1 i586)
PATH = /bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin
HTTP_CONNECTION = Keep-Alive
HTTP_ACCEPT = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
image/png, */* REMOTE_PORT = 4876
HTTP_ACCEPT_LANGUAGE = en
MOD_PERL = mod_perl/1.17
SCRIPT_NAME = /cgi-bin/test.pl
SCRIPT_FILENAME = /usr/local/httpd/cgi-bin/test.pl
HTTP_ACCEPT_ENCODING = gzip
SERVER_NAME = Homer.suse.com
REQUEST_URI = /cgi-bin/test.pl
HTTP_ACCEPT_CHARSET = iso-8859-1,*,utf-8
SERVER_PORT = 80
HTTP_HOST = Homer.suse.com
SERVER_ADMIN = root@localhost
|
|
|
|
|
17.1.3 | icons |
|
The GIF files used by Apache to create directory listings are stored in this directory.
|
![TIP](gif/icon_tip.gif) |
Unfortunately, the permissions for this directory are not correct in
the standard installation. In order to make this work, you have to
change them by setting the x flag for everybody:
|
| # chmod a+x /usr/local/httpd/icons
|
|
|
|
|
17.1.4 | include |
|
Include files needed to compile additional Apache modules are stored
here. You need them only if you want to extend the functionality of
the server by adding your own modules or modules you
got somewhere on the Internet.
|
17.2 | Permitting user home pages |
|
Besides having a main document tree, each user on the system can have
his or her own homepage. The way SuSE sets it up makes this quite
simple. All a user has to do is to create the directory
public_html in his or her home directory. The file
index.html in public_html represent the
user's home page, and all relative links will be placed in this
directory or a subdirectory of it. The URL to access a user's home
is http://server-name/~user-name.
Apache has several possible setups for user home pages. You may want
to change the setup if your Web server is on a machine other than
that containing the user home directories. You could, for example,
have a dedicated directory with subdirectories for each user. Please
refer to Apache's documentation for more details.
|
17.3 | More information |
|
There are several good books about Apache that explain the overall
concepts and give examples of different setups for different
purposes:
|
|
![*](gif/bullet.gif) ![](gif/clear.gif) |
Apache: The Definitive Guide, edited by Ben Laurie, Peter Laurie, and Robert Denn
|
![*](gif/bullet.gif) ![](gif/clear.gif) |
Apache Server Bible, by Mohammed J. Kabir
|
![*](gif/bullet.gif) ![](gif/clear.gif) |
Apache Server for Dummies, by Ken A. L. Coar
|
|
|
|
![](gif/black.gif) |
Summary: |
|
Apache is the HTTP server shipped with SuSE Linux. HTTP is the
protocol used by the World103 Wide Web (WWW) for hypertext
documents. SuSE's Apache setup needs almost no additional
configuration. Its default setting is adequate for a standard WWW
server. The server document tree is located in
/usr/local/httpd/htdocs. In addition to these documents,
all users on the system can have their own homepage by placing
their documents into the subdirectory public_html of their home
directory.
|
![](gif/black.gif) |