You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Andrew Wilson <an...@tees.elsevier.co.uk> on 1996/01/11 12:38:13 UTC

mod_env.c...

... has been copied to www.apache.org/dist/contrib/modules.  The
module's been used for a while now by people converting from CERN to
Apache and the nth bug report of the week asking for this convinced me
to make it public.  From the module's header:

This module allows Apache's CGI and SSI environment to inherit
environment variables from the shell which invoked the httpd process.
CERN webservers are able to do this, so this module is especially
useful to webadmins who wish to migrate from CERN to Apache without
rewriting all their scripts
 
The module accepts two new directives, PassEnv and SetEnv both of which
may appear in configuration files, but not in .htaccess files.  The
directives may also appear inside VirtualHost sections so that a
different set of environment variables may be exported to each virtual
host.  You can add the following sorts of commands to your httpd.conf 
file.
 
     # The default server knows about SPECIAL_PATH
     PassEnv SPECIAL_PATH
 
     <VirtualHost host.foo.com>
     # .foo. needs additional special paths
     PassEnv LD_LIBRARY_PATH
     SetEnv FOO_PATH /virtual/foo/bin
     ...
     </VirtualHost>
 
     <VirtualHost host.bar.com>
     # .bar. overrides the default special path
     SetEnv SPECIAL_PATH /virtual/bar/bin
     ...
     </VirtualHost>


Cheers,
Ay.


Re: mod_env.c...

Posted by Tony Sanders <sa...@bsdi.com>.
Andrew Wilson writes:
> ... has been copied to www.apache.org/dist/contrib/modules.  The
> module's been used for a while now by people converting from CERN to
> Apache and the nth bug report of the week asking for this convinced me
> to make it public.  From the module's header:

Which brings up a (minor) point I would like to offer to the group.
I decided about a year ago that I should really be running my web
server from a known environment -- when starting at system boot
time the environment is very clean but if you kill it and restart it
from your login shell later then the environment is fairly polluted.

So I wrote the little wrapper startup script below that lets me
control the enviroment.  Feel free to use something like this if
it would be useful.

#!/bin/sh
# setup a known secure environment for the server
/usr/bin/env - \
	LOGNAME="www" \
	USER="$LOGNAME" \
	PATH="/usr/bin:/bin:/usr/X11/bin:/usr/sbin:/sbin:/usr/contrib/bin:/usr/contrib/mh/bin" \
	HOME="/bsdi/www" \
	BLOCKSIZE=1024 \
	NAME="BSDI Web Account" \
	ORGANIZATION="Berkeley Software Design, Inc." \
	SHELL="/bin/sh" \
	/usr/contrib/bin/daemon /bsdi/www/server/plexus -h bsdi.BSDI.COM \
		-s /bsdi/www/server -c bsdi.conf -d /bsdi/www \
		</dev/null >/dev/null 2>&1