[TEACHING] Installation of SRSWWW under CERN httpd 3.0 - Part 1

"Nicole Redaschi"redaschi at biox.embnet.unibas.ch "Nicole Redaschi"redaschi at biox.embnet.unibas.ch
Mon Apr 24 04:21:17 EST 1995


********************************************************************************
		  Installation of SRSWWW under CERN httpd 3.0
		    Part 1: Installation of CERN WWW Server
********************************************************************************

This documentation is a "cookbook recipe" for the installation of CERN httpd 3.0 
on UNIX platforms using precompiled binaries. It contains step-by-step 
instructions for the basic (!) setup of the CERN http server. For more detailed 
informations read the CERN Server Guide (see below).


1. Getting Informations and the Program
---------------------------------------
Go to the directory where you want to install the http server (in this example 
called "WWW"). 

%	cd WWW

The CERN server distribution is available from the "ftp.w3.org" anonymous ftp 
account. At the date of this writing, informations about the CERN http deamon 
are located in the directory "pub/www/doc": look for the files 
"cern-httpd-guide.ps.Z" and "cern-httpd-docs.tar.Z" and 'get' them. The first 
is a PostScript version of the CERN Server User Guide, the second is a directory 
comprising a set of HTML documents for the WWW version of the Guide. In this 
example, the WWW version of the Guide will be used to test the successful 
installation of the server.

To get the httpd binaries you have to go to the directory "pub/www/bin". From 
there, go to the subdirectory corresponding to your machine architecture (eg. 
"osf1" if you have an osf1 machine), 'get' the files "cern_httpd_3.0.tar.Z" and 
"cern_httpd_utils_3.0.tar.Z" and 'quit'. 

%	ftp ftp.w3.org
Name:	anonymous
Password: 
ftp>	cd pub/www/doc
ftp>	ls -lsa
ftp>	get cern-httpd-guide.ps.Z  
ftp>	get cern-httpd-docs.tar.Z 
ftp>	cd ../bin
ftp>	ls -lsa
ftp>	cd osf1
ftp>	ls -lsa
ftp>	get cern_httpd_3.0.tar.Z 
ftp>	get cern_httpd_utils_3.0.tar.Z
ftp>	quit

Uncompress all files and untar the tar files. "cern-httpd-docs.tar.Z" will form
the directory "httpd_docs"; "cern_httpd_3.0.tar.Z" together with 
"cern_httpd_utils_3.0.tar.Z" will form the common directory tree "cern_httpd_3.0".

% 	uncompress cern-httpd-guide.ps.Z
% 	uncompress cern-httpd-docs.tar.Z 
%	uncompress cern_httpd_3.0.tar.Z 
%	uncompress cern_httpd_utils_3.0.tar.Z
% 	tar xvf cern-httpd-docs.tar
%	tar xvf cern_httpd_3.0.tar 
%	tar xvf cern_httpd_utils_3.0.tar


2. Customizing the http Configuration File 
------------------------------------------
In the subdirectory "config" of your new directory "cern_httpd_3.0" you will 
find example configuration files. Keep the originals and work on a copy!
The "httpd.conf" file is for a regular http server, the "caching.conf" file is 
for a proxy server and has the advantage that it allows caching. Below are 
examples of customized versions of the "httpd.conf" and "caching.conf"
configuration files. The edited parts are given between pairs of wavy lines 
(#~~~~~~). Follow these examples to customize your configuration file.

EXAMPLE
------------------------------ "httpd.conf"-begin ------------------------------
#
#	Sample configuration file for cern_httpd for running it
#	as a normal HTTP server.
#
# See:
#	<http://info.cern.ch/hypertext/WWW/Daemon/User/Config/Overview.html>
#
# for more information.
#
# Written by:
#	Ari Luotonen  April 1994  <luotonen at dxcern.cern.ch>
#

#
#	Set this to point to the directory where you unpacked this
#	distribution, or wherever you want httpd to have its "home"
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ServerRoot	/where/ever/server_root
ServerRoot	/AbsolutePath.../WWW/httpd_docs
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#
#	The default port for HTTP is 80; if you are not root you have
#	to use a port above 1024; good defaults are 8000, 8001, 8080
#
Port	80

#
#	General setup; on some systems, like HP, nobody is defined so
#	that setuid() fails; in those cases use a different user id.
#
UserId	nobody
GroupId	nogroup

#
#	Logging; if you want logging uncomment these lines and specify
#	locations for your access and error logs
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# AccessLog	/where/ever/httpd-log
AccessLog	/AbsolutePath.../WWW/log/httpd-access
# ErrorLog	/where/ever/httpd-errors
ErrorLog	/AbsolutePath.../WWW/log/httpd-error
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LogFormat	Common
LogTime		LocalTime

#
#	User-supported directories under ~/public_html
#
UserDir	public_html

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#	The Map-directive maps a virtual URL into a physical path in your file 
#	system. In this example, URLs starting with /httpd-internal-icons/* will 
#	be mapped to the path /cern_icons/*. This address will be passed to the
#	Exec- and Pass-directives that follow.
#
Map	/httpd-internal-icons/*		/cern_icons/*
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#
#	Scripts; URLs starting with /cgi-bin/ will be understood as
#	script calls in the directory /your/script/directory
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Exec	/cgi-bin/*	/your/script/directory/*
Exec	/cgi-bin/*	/AbsolutePath.../WWW/cern_httpd_3.0/cgi-bin/*
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#
#	URL translation rules; If your documents are under /local/Web
#	then this single rule does the job:
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Pass	/*	/local/Web/*
Pass	/*	/AbsolutePath.../WWW/httpd_docs/*
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------ "httpd.conf"-end --------------------------------

EXAMPLE
---------------------------- "caching.conf"-begin ------------------------------
#
#	Sample configuration file for cern_httpd for running it
#	as a proxy server WITH caching.
#
# See:
#	<http://info.cern.ch/hypertext/WWW/Daemon/User/Config/Overview.html>
#
# for more information.
#
# Written by:
#	Ari Luotonen  April 1994  <luotonen at dxcern.cern.ch>
#

#
#	Set this to point to the directory where you unpacked this
#	distribution, or wherever you want httpd to have its "home"
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ServerRoot	/where/ever/server_root
ServerRoot	/AbsolutePath.../WWW/httpd_docs
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#
#	Set the port for proxy to listen to
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Port	8080
Port	80
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#
#	General setup; on some systems, like HP, nobody is defined so
#	that setuid() fails; in those cases use a different user id.
#
UserId	nobody
GroupId	nogroup

#
#	Logging; if you want logging uncomment these lines and specify
#	locations for your access and error logs
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# AccessLog	/where/ever/httpd-log
AccessLog	/AbsolutePath.../WWW/log/httpd-access
ProxyAccessLog	/AbsolutePath.../WWW/log/proxy-access
CacheAccessLog	/AbsolutePath.../WWW/log/proxy-cache
# ErrorLog	/where/ever/httpd-errors
ErrorLog	/AbsolutePath.../WWW/log/proxy-error
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LogFormat	Common
LogTime		LocalTime

#
#	Proxy protections; if you want only certain domains to use
#	your proxy, uncomment these lines and specify the Mask
#	with hostname templates or IP number templates:
#
# Protection PROXY-PROT {
# 	ServerId	YourProxyName
# 	Mask		@(*.cern.ch, 128.141.*.*, *.ncsa.uiuc.edu)
# }
# Protect  *  PROXY-PROT

#
#	Pass the URLs that this proxy is willing to forward.
#
Pass	http:*
Pass	ftp:*
Pass	gopher:*
Pass	wais:*

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
#	If you want to run a regular http server at the same time, add the
#	following rules (see the above example for the "http.conf" file)
#
Map	/httpd-internal-icons/*	/cern_icons/*

Exec	/cgi-bin/*		/AbsolutePath.../WWW/cern_httpd_3.0/cgi-bin/*

Pass	/*			/AbsolutePath.../WWW/httpd_docs/*
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#
#	Enable caching, specify cache root directory, and cache size
#	in megabytes
#
Caching		On
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# CacheRoot	/your/cache/root/dir
CacheRoot	/AbsolutePath.../WWW/cache_root
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CacheSize	5

#
#	Specify absolute maximum for caching time
#
CacheClean	*	2 months

#
#	Specify the maximum time to be unused
#
CacheUnused	http:*		2 weeks
CacheUnused	ftp:*		1 week
CacheUnused	gopher:*	1 week

#
#	Specify default expiry times for ftp and gopher;
#	NEVER specify it for HTTP, otherwise documents generated by
#	scripts get cached which is usually a bad thing.
#
CacheDefaultExpiry	ftp:*		10 days
CacheDefaultExpiry	gopher:*	2 days

#
#	Garbage collection controls; daily garbage collection at 3am;
#
Gc		On
GcDailyGc	3:00
---------------------------- "caching.conf"-end --------------------------------


3. Creating Directories and Symbolic Links
-----------------------------------------
If you are not interested in logging information, just leave the corresponding 
part as it is in the original configuration files. If you copied one of the 
customized example files above, go to your directory "WWW" and create the 
subdirectory "log": 

% 	cd WWW
%	mkdir log

If you want to run a proxy server with caching, you also had to indicate the
"CacheRoot" directory, which is "/AbsolutePath.../WWW/cache_root" in the given 
example. Create the corresponding directory: 

%	mkdir cache-root

In the customized configuration files, the Pass-directive for the regular http 
server will map all URLs to the directory "/AbsolutePath.../WWW/httpd_docs" 
(which is the "ServerRoot" directory). If certain URLs have to be mapped to a 
different directory, you have to do two things:
1.	go to your "ServerRoot" directory and add a symbolic link pointing to 
	the respective directory
2.	to your httpd configuration file, add a Map-directive which maps all 
	URLs that start with a certain path to that symbolic link
Eg. the Map-directive "Map /httpd-internal-icons/* /cern_icons/*" maps all URLs 
starting with "/httpd-internal-icons/*" to the symbolic link "cern_icons", which 
shall point to the directory "/AbsolutePath.../WWW/cern_httpd_3.0/icons/". For 
this to work, you have to add the symbolic link "cern_icons", pointing to the 
directory "/AbsolutePath.../WWW/cern_httpd_3.0/icons/", to the "ServerRoot" 
directory.

%	cd  WWW/httpd_docs
%	ln -s /AbsolutePath.../WWW/cern_httpd_3.0/icons cern_icons


4. Trying It Out in Verbose Mode
--------------------------------
In order to check whether everything has been set correctly, start the http 
server by hand in verbose mode and look what happens when you make a request 
with your browser. You have to indicate the path of your http configuration file
with the command line option "-r". Test servers are typically run on a non-
priviledged port above 1024, often 8001, 8080, or such (the official http port 
is 80). The server port is defined in the configuration file by the Port-
directive, but you can override it with the command line option "-p" while 
testing it. 

%    cd  WWW/cern_httpd_3.0/bin
%    httpd -v -r  /AbsolutePath.../WWW/cern_httpd_3.0/config/httpd.conf -p 8080
or:
%    httpd -v -r  /AbsolutePath.../WWW/cern_httpd_3.0/config/caching.conf -p 8080

Now, start your browser and open the URL http://your_server:8080. If everything
works fine you should get the CERN "index.html" (-> "Guide.html") page as a 
Welcome page. There you can read more details about CERN httpd 3.0. 


5. Stand-Alone Installation
--------------------------- 
If you are done with testing, stop the test run. Before starting the http server
in stand-alone mode, change the protection of the two directories "log" and 
"cache_root" to allow access by "nobody".

%	chmod -R 777 log
%	chmod -R 777 cache_root

For the actual installation of httpd in stand-alone mode, you need to create 
a new startup file. Go to the directory where you keep your system startup files 
and set up a new file "S_httpd" as described below.
         
----------------------------- "S_httpd"-begin ----------------------------------
#!/sbin/sh

  if [ -f /AbsolutePath.../WWW/cern_httpd_3.0/bin/httpd ] ; then 
    if [ -f /AbsolutePath.../WWW/cern_httpd_3.0/config/httpd.conf ] ; then 
    echo "Starting httpd"
    (/AbsolutePath.../WWW/cern_httpd_3.0/bin/httpd -r /AbsolutePath.../WWW/cern_
			httpd_3.0/config/httpd.conf) &> /dev/console 
    else 
    echo "Problem with configuration file: no httpd started"
    fi 
  else 
  echo "Problem with httpd image: no httpd started"
  fi
----------------------------- "S_httpd"-end ------------------------------------

Change the protection of the new startup file, then start it.

#	chmod 744 S_httpd
#	S_httpd		

If you did everything correctly, you will get the message "Starting httpd".



Have fun!

Nicole Redaschi 

-------------------------------------------------------------------------------- 
 Nicole Redaschi                               <redaschi at biox.embnet.unibas.ch>  
 Biocomputing-Biozentrum der Universitaet Basel-Klingelbergstr.70-CH 4056 Basel
--------------------------------------------------------------------------------












More information about the Bio-www mailing list