James Thornton logo
James Thornton
Google
Web jamesthornton.com
Internet Business Consultant
Home Blog Bio Projects Contact
JamesThornton.com -\> ACS -\> nsunix & AOLserver 3.1

HOWTO: Virtual Hosting with nsunix & AOLserver 3.1

This page describes how to enable virtual hosting on AOLServer 3.1 with domain sockets by way of the nsunix module. Linux is the OS used in this example.

NOTE: I tried to replicate this on a new system last night and it did NOT work -- I will update this when I figure out why.

I discovered the error -- ensure that GET and POST are in ALLCAPS in section ns/server/master/module/nsvhr.

Example:

#
# Configure the nsvhr module for master only
#
# IMPORTANT: GET and POST must be in ALLCAPS!!!
ns_section "ns/server/master/module/nsvhr"
ns_param method      "GET"
ns_param method      "POST"
ns_param timeout     29

Patch AOLServer 3.1

AOLServer 3.1 requires a patch for the nsunix module to work. Jerry Asher developed the nsunix patch for AOLserver 3 rc2, and Steven Caranci merged it into the AOLserver 3.1 source.

Configure AOLserver 3.1 for nsunix

You can use one config file for each server, or you can use one for all servers. This example uses one config file, nsd.tcl, for all servers.

  • nsd.tcl example: http://www.jamesthornton.com/acs/nsd-nsunix.txt
  • Some key excerpts:
    ################################################
    #
    # ADP (AOLserver Dynamic Page) configuration
    #
    
    # master - don't configure master for ADP (it's a proxy server)
    
    # umind
    ns_section "ns/server/umind/adp"
    ns_param   map             "/*.adp"  ;# Extensions to parse as ADP's.
    ns_param   map             "/*.html" ;# Any extension can be mapped.
    ns_param   DefaultParser   fancy
    ns_param   enableexpire    false     ;# Set "Expires: now" on all ADP's.
    ns_param   enabledebug     false     ;# Allow Tclpro debugging with "?debug".
    
    # jtdc
    ns_section "ns/server/jtdc/adp"
    ns_param   map             "/*.adp"  ;# Extensions to parse as ADP's.
    ns_param   map             "/*.html" ;# Any extension can be mapped.
    ns_param   DefaultParser   fancy
    ns_param   enableexpire    false     ;# Set "Expires: now" on all ADP's.
    ns_param   enabledebug     false     ;# Allow Tclpro debugging with "?debug".
    
    
    ################################################
    #
    # Socket driver module (HTTP)  -- nssock
    #
    
    # master
    ns_section "ns/server/master/module/nssock"
    ns_param   hostname        master.unifiedmind.com
    ns_param   address         192.168.1.11
    ns_param   port		   80
    ns_param   timeout         120
    ns_param   closewait       0
    
    # umind
    ns_section "ns/server/umind/module/nssock"
    ns_param   hostname        www.unifiedmind.com
    ns_param   address         192.168.1.11
    ns_param   port            8000
    ns_param   timeout         120
    
    # jtdc
    ns_section "ns/server/jtdc/module/nssock"
    ns_param   hostname        www.jamesthornton.com
    ns_param   address         192.168.1.11
    ns_param   port            8080
    ns_param   timeout         120
    
    #
    # Configure nsunix module with the hostname and sockefile name
    #
    # umind
    ns_section "ns/server/umind/module/nsunix"
    ns_param hostname     "www.unifiedmind.com"
    ns_param socketfile   "umind.nsunix"
    
    # jtdc
    ns_section "ns/server/jtdc/module/nsunix"
    ns_param hostname     "www.jamesthornton.com"
    ns_param socketfile   "jtdc.nsunix"
    
    #
    # Configure the nsvhr module for master only
    #
    # IMPORTANT: GET and POST must be in ALLCAPS!!!
    ns_section "ns/server/master/module/nsvhr"
    ns_param method      "GET"
    ns_param method      "POST"
    ns_param timeout     29
    
    #
    # Configure the nsvhr module to map requests from domain to "socket file" 
    #
    ns_section "ns/server/master/module/nsvhr/maps"
    ns_param "unifiedmind.com"         "unix://umind.nsunix"
    ns_param "www.unifiedmind.com"     "unix://umind.nsunix"
    ns_param "jamesthornton.com"       "unix://jtdc.nsunix"
    ns_param "www.jamesthornton.com"   "unix://jtdc.nsunix"
    
    
    ################################################
    #
    # Modules to load
    #
    
    # master
    ns_section "ns/server/master/modules"
    ns_param   nssock          ${bindir}/nssock${ext}
    ns_param   nsvhr           ${bindir}/nsvhr${ext}
    
    # umind
    ns_section "ns/server/umind/modules"
    ns_param   nssock          ${bindir}/nssock${ext}
    ns_param   nslog           ${bindir}/nslog${ext}
    ns_param   nscgi           ${bindir}/nscgi${ext}  ;# Map the paths before using.
    ns_param   nsperm          ${bindir}/nsperm${ext} ;# Edit passwd before using.
    ns_param   nssha1          ${bindir}/nssha1${ext}
    ns_param   nscache         ${bindir}/nscache${ext}
    ns_param   nsunix          ${bindir}/nsunix${ext}
    #ns_param   nsvhr           ${bindir}/nsvhr${ext}
    
    # jtdc
    ns_section "ns/server/jtdc/modules"
    ns_param   nssock          ${bindir}/nssock${ext}
    ns_param   nslog           ${bindir}/nslog${ext}
    ns_param   nscgi           ${bindir}/nscgi${ext}  ;# Map the paths before using.
    ns_param   nsperm          ${bindir}/nsperm${ext} ;# Edit passwd before using.
    ns_param   nssha1          ${bindir}/nssha1${ext}
    ns_param   nscache         ${bindir}/nscache${ext}
    ns_param   nsunix          ${bindir}/nsunix${ext}
    #ns_param   nsvhr           ${bindir}/nsvhr${ext}
    
  • Start the servers
    $ su -
    # cd /usr/local/aolserver
    # ./bin/nsd-oracle -s master -kt nsd.tcl -u nsadmin
    # ./bin/nsd-oracle -s umind -kt nsd.tcl -u nsadmin
    # ./bin/nsd-oracle -s jtdc -kt nsd.tcl -u nsadmin
    
  • Ensure that your DNS is configured so that all domains used by the virutual servers point to the one well-known IP address. If you have a firewall, forward port 80 to the master server's IP address.
  • Use your web browser to test if the sites are up.
  • When everything works, make the appropriate entries into /etc/inittab.

Related Reading


Follow espeed on Twitter