Minimal AOLserver Configuration
Contents
the bare minimum
The following is the absolute minimum configuration needed to run AOLserver, it is meant to run chrooted and prepared to run several virtual hosts, each one named the same as its fully qualified domain name:
ns_section ns/parameters ns_param home / ns_param servername "Main AOLserver instance" ns_param user www-data ns_param group www-data ns_param serverlog /log/error.log ns_param pidfile /log/pid ns_section ns/servers ns_param localhost "local Website" ns_section ns/server/localhost ns_param directoryfile index.html ns_param pageroot /localhost/www ns_section ns/server/localhost/tcl ns_param library /localhost/tcl ns_section ns/server/localhost/module/nssock ns_param port 8000 ns_param hostname localhost ns_param address 127.0.0.1 ns_section ns/server/localhost/module/nslog ns_param file /localhost/log/access.log ns_section ns/server/localhost/modules ns_param nssock nssock.so ns_param nslog nslog.so
If this is put into the file main.tcl
AOLserver can be run with the following commandline:
aolserver-nsd -u www-data -g www-data -b localhost:8000 -r /var/www/main -t main.tcl
real live example
Now comes the same stuff pepped up a little; it's the configuration I actually use for my testing and playground installation of AOLserver on my notebook.
Added are
- comments
- variables for illustration/clarity
- an option to run either chrooted or non-chrooted
- cgi-module configuration
I also use FHS compatibility for filenames and directories (FHS: directory naming convention invented by Linux distributors)
Configuration file
# Configuration Variables set instance main set description "Main Aolserver Instance" set domain localhost set domain_description "local Website" set address 127.0.0.1 set port 8000 set debug false set chroot true # empty home results in / as server home, which is # what we want after chroot-ing set home [expr {$chroot ? "" : "/var/lib/aolserver/$instance"}] # AOLserver configuration starts here, no user servicable parts inside ns_section ns/parameters # The following is not required, debugging defaults to false ns_param debug $debug ns_param home ${home}/ ns_param servername $description ns_param user www-data ns_param group www-data ns_param serverlog $home/log/error.log ns_param pidfile $home/log/pid ns_section ns/servers ns_param $domain $domain_description ns_section ns/server/$domain ns_param directoryfile index.html ns_param pageroot $home/$domain/www ns_section ns/server/$domain/tcl ns_param library $home/$domain/tcl ns_section ns/server/$domain/module/nssock ns_param port $port ns_param hostname $domain ns_param address $address ns_section ns/server/$domain/module/nslog ns_param file $home/$domain/log/access.log ns_section ns/server/$domain/module/nscgi ns_param map "GET /cgi-bin $home/cgi-bin" ns_param map "POST /cgi-bin $home/cgi-bin" ns_param map "GET /xx" ns_section "ns/server/$domain/modules" ns_param nssock nssock.so ns_param nslog nslog.so ns_param nscgi nscgi.so
Command line
You can run AOLserver chrooted with this configuration file (name it main.tcl
)
using the following commandline:
aolserver-nsd -u www-data -g www-data \ -b localhost:8000 \ -r /var/lib/aolserver4/main \ -t main.tcl
or not chrooted (set chroot false
in main.tcl
):
aolserver-nsd -u www-data -g www-data \ -b localhost:8000 \ -t main.tcl
if running under supervise or inetd add the "-f" switch to the commandline
Adding a virtual host
lets say we add www.local
as an alias for the loopback interface (127.0.0.1)
to experiment with virtual hosts. I will show how to do it with the bare minimum configuration
"Register" the new virtual host: ...
ns_section ns/servers ns_param localhost "local Website" ns_param www.local "A second Website"
...
And add the following at the bottom of main.tcl
...
ns_section ns/server/www.local ns_param directoryfile index.html ns_param pageroot /www.local/www ns_section ns/server/www.local/tcl ns_param library /www.local/tcl ns_section ns/server/www.local/module/nssock ns_param port 8000 ns_param hostname www.local ns_param address 127.0.0.1 ns_section ns/server/www.local/module/nslog ns_param file /www.local/log/access.log
Chroot requirements
Here is an excerpt of the files I needed to copy into the chroot to get the server running:
/var/lib/aolserver4/main/bin/nslog.so /var/lib/aolserver4/main/bin/nssock.so /var/lib/aolserver4/main/bin/init.tcl
... of course I copied the whole modules directory, not only the above ...
/var/lib/aolserver4/main/dev/null /var/lib/aolserver4/main/etc/group
...
the contents of the group
file is:
www-data:x:33:
...
/var/lib/aolserver4/main/etc/localtime /var/lib/aolserver4/main/usr/lib/locale/locale-archive /var/lib/aolserver4/main/usr/lib/tcl8.4/encoding/*
... also, I copied the whole encoding directory of the tcl8.4 distribution, I guess, that only some of the files are really needed ...
/var/lib/aolserver4/main/proc /var/lib/aolserver4/main/modules/tcl/init.tcl
see also: http://www.magma.com.ni/moin/AolserverMe, for my experiences while checking out these things.