Setting Up a Unix Server
We can point httpd
at our site with the -d flag (notice
the full pathname to the site.toddle directory,
which will probably be different on your machine):
% httpd -d /usr/www/APACHE3/site.toddleSince you will be typing this a lot, it’s sensible to copy it into a script called go . This can go in /usr/local/bin or in each local site. We have done the latter since it is convenient to change it slightly from time to time. Create it by typing:
% cat > /usr/local/bin/go test -d logs || mkdir logs httpd -f 'pwd'/conf/httpd$1.conf -d 'pwd' ^d
^d is shorthand for Ctrl-D, which ends the input
and gets your prompt back. This go will work on
every site. It creates a logs directory if one
does not exist, and it explicitly specifies paths for the ServerRoot
directory (-d) and the Config file
(-f). The command
'
pwd
'
finds the current directory with the Unix command
pwd
. The back-ticks are
essential: they substitute pwd’s
value into the script — in other words, we will run Apache with
whatever configuration is in our current directory. To accomodate
sites where we have more than one Config file, we have used
...httpd$1... where you might expect to see
...httpd... The symbol $1
copies the first argument (if any) given to the command
go
. Thus ./go
2 will run the Config file called httpd2.conf,
and ./go by itself will run
httpd.conf.
Remember that you have to be in the site directory. If you try to run
this script from somewhere else, pwd’s return will be nonsense, ...