info.cern.ch
anonymous ftp account.
Often you don't need to compile the server yourself, precompiled
binaries are available for many Unix platforms.
If there is no precompiled version for your platform, of if it doesn't
work (e.g. the name resolution doesn't work), you should get the
source code and compile it yourself.
ftp://info.cern.ch/pub/www/bin
(in the subdirectory corresponding your machine architecture).
ftp://info.cern.ch/pub/www/src/cern_httpd.tar.Z
. Compilation:
uncompress cern_httpd.tar.Z tar xvf cern_httpd.tar
WWW
directory, and give
command ./BUILD
:
cd WWW ./BUILD
httpd
appears in directory
.../WWW/Daemon/sun4
(if you have a Sun4
machine), or in another subdirectory corresponding to
your machine architecture. The utility programs go to
the same directory
(htadm
,
htimage
,
cgiparse
and
cgiutils
).
httpd
requires a configuration file, the
default configuration file is /etc/httpd.conf
.
If this doesn't suit you, you can specify another location to
it using the -r
option:
httpd -r /other/place/httpd.conf
cern_httpd/config
inside the
binary distribution, or
WWW/server_root
inside the source code
distribution.
ftp://info.cern.ch/pub/www/src/server_root.tar.Z
/Public/Web
, the easiest way to make them available to
the world is to specify the following rule in your configuration file:
Pass /* /Public/Web/*This maps all the requests under the directory
/Public/Web
and accepts them.
The default welcome document (what you get with URL of form
http://your.host/
) is now Welcome.html
in
the directory /Public/Web
.
httpd
feel tedious - this doesn't have to be
so. In the beginning start httpd
by hand in verbose mode
to listen to some port, and look what happens when you make a request
to that port with your browser.
Typically test servers are run on a non-priviledged port above 1024
(you don't have to be root
to bind to them), often 8001,
8080, or such. Official HTTP port is 80.
The server port is defined in the configuration file with the Port
directive,
but you can override it with the -p
command line option
while testing; e.g.
httpd -v -r /home/you/httpd.conf -p 8080This will start
httpd
in verbose mode, use configuration
file httpd.conf
in your home directory, and accept
connections to port 8080. You can now try to request a document form your server using a URL of form:
http://your.host:8080/document.htmlwhere
document.html
is relative to the directory that you
have exported in your configuration file. If you get an error message back see the verbose output to find out what is going wrong - it is usually self-explanatory.
And remember, you should always feel free to ask advice from httpd@info.cern.ch.
(inetd)
.
A stand-alone server is typically started once at system-boot time.
It waits for incoming connections, and forks itself to serve a
request. This is much faster than letting
inetd
spawn httpd
every time a request
comes. We therefore recommend that you run CERN httpd in
stand-alone mode.
/etc/rc.local)
so that it runs
continuously like the sendmail
daemon, for example.
This method has the advantage over using the inetd
that
the response time is reduced.
Add a line starting httpd
to your system startup file
(usually /etc/rc.local
or /etc/rc
). If you
have the configuration file in the default place,
/etc/httpd.conf
, and if it specifies the port to listen
to via the Port
directive, you don't need any command
line options:
/usr/etc/httpd &
httpd
will automatically go background so there is really no
need for an ampersand in the end (as long as your configuration file
/etc/httpd.conf
really exists). Or a little more safely in case httpd is removed:
if [ -f /usr/etc/httpd ]; then (/usr/etc/httpd && (echo -n ' httpd') ) & >/dev/console fiNaturally you can use any of the command line options, if necessary.
httpd
up and running, and you have
documents to show the word, announce
your server, so that others can find it.
-v
option and
try to figure out what goes wrong. See also the debugging chart and the FAQ. If you can't figure out what's going
wrong, feel free to send mail to httpd@info.cern.ch