Difference between revisions of "Conf/Examples/VirtualHosts"

From AOLserver Wiki
Jump to navigation Jump to search
(Created page with '= Virtual Hosts Configuration = part of AOLserver Config Examples # Configuration Variables set instance main set description "Main Aolserver Instance…')
 
 
Line 2: Line 2:
 
[[Conf/Examples | part of AOLserver Config Examples]]
 
[[Conf/Examples | part of AOLserver Config Examples]]
  
  # Configuration Variables
+
This config provides HTTP 1.1 style virtual hosts.  
  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
+
nssock is loaded globally and configured to map domain names to virtual servers.
  set chroot true
 
  
  # empty home results in / as server home, which is
+
Each virtual server then loads and configures any modules it needs. In this case just nslog for access logs.
  # what we want after chroot-ing
 
  set home [expr {$chroot ? "" : "/var/lib/aolserver/$instance"}]
 
 
 
  # AOLserver configuration starts here, no user servicable parts inside
 
  
 +
  # Global Parameters
 
   ns_section ns/parameters
 
   ns_section ns/parameters
 
+
   ns_param home /usr/lib/aolserver4
  # The following is not required, debugging defaults to false
+
   ns_param servername "Main AOLserver Process"
  ns_param debug $debug
+
   ns_param serverlog /var/log/aolserver4/virtual-hosts.log
 
+
   ns_param pidfile /var/run/aolserver4/virtual-hosts.pid
   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_section ns/servers
   ns_param  www.vh1.com "first virtual host"
+
   ns_param  server1 "Website 1"
 +
  ns_param  server2 "Website 2"  
  
   ns_section ns/server/www.vh1.com
+
   # Load nssock
  ns_param  directoryfile  index.html
+
   ns_section ns/modules
  ns_param  pageroot        /var/www/vh1/www
+
   ns_param  nssock            nssock.so
 
 
   ns_section ns/server/www.vh1.com/tcl
 
   ns_param  library /var/www/vh1/tcl
 
  
   ns_section ns/server/www.vh1.com/module/nssock
+
  # Configure nssock
   ns_param  port            8000
+
   ns_section ns/module/nssock
  ns_param  hostname        www.vh1.com
+
   ns_param  port            80
 
   ns_param  address        127.0.0.1
 
   ns_param  address        127.0.0.1
 
+
   ns_param  defaultserver   server1
  ns_section ns/server/www.vh1.com/module/nslog
 
  ns_param  file            /var/log/vh1/access.log
 
 
 
  ns_section ns/server/www.vh1.com/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/www.vh1.com/modules"
 
   ns_param  nssock            nssock.so
 
  ns_param  nslog              nslog.so
 
  ns_param   nscgi              nscgi.so
 
  
 +
  # Map hostnames to virtual servers
 +
  ns_section ns/module/nssock/servers
 +
    ns_param server1 example1.com
 +
    ns_param server2 example2.com
  
   ns_section ns/servers
+
   # virtual server 1
  ns_param  www.vh2.com "second virtual host"
+
   ns_section ns/server/server1
 
 
   ns_section ns/server/www.vh2.com
 
 
   ns_param  directoryfile  index.html
 
   ns_param  directoryfile  index.html
   ns_param  pageroot        /var/www/vh2/www
+
   ns_param  pageroot        /var/www/example1.com
 
 
  ns_section ns/server/www.vh2.com/tcl
 
  ns_param  library /var/www/vh2/tcl
 
 
 
  ns_section ns/server/www.vh2.com/module/nssock
 
  ns_param  port            8000
 
  ns_param  hostname        www.vh2.com
 
  ns_param  address        127.0.0.1
 
 
 
  ns_section ns/server/www.vh2.com/module/nslog
 
  ns_param  file            /var/log/vh2/access.log
 
 
 
  ns_section ns/server/www.vh2.com/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/www.vh2.com/modules"
 
  ns_param  nssock            nssock.so
 
  ns_param  nslog              nslog.so
 
  ns_param  nscgi              nscgi.so
 
  
 +
  # modules for server1
 +
  ns_section ns/server/server1/modules
 +
    ns_param  nslog        nslog.so
  
 +
  # Configure server1 accesslog
 +
  ns_section ns/server/server1/module/nslog
 +
  ns_param  file            /var/log/aolserver4/example1.com.access.log
  
   ns_section ns/servers
+
  # virtual server2
   ns_param  www.vh3.com "third virtual host"
+
   ns_section ns/server/server2
 +
   ns_param  directoryfile  index.html
 +
  ns_param  pageroot        /var/www/example2.com
  
   ns_section ns/server/www.vh3.com
+
   ns_section ns/server/server2/modules
  ns_param  directoryfile  index.html
+
   ns_param  nslog        nslog.so
   ns_param  pageroot        /var/www/vh3/www
 
 
 
  ns_section ns/server/www.vh3.com/tcl
 
  ns_param  library /var/www/vh3/tcl
 
  
   ns_section ns/server/www.vh3.com/module/nssock
+
   ns_section ns/server/server2/module/nslog
  ns_param  port            8000
+
   ns_param  file         /var/log/aolserver4/example2.com.access.log
  ns_param  hostname        www.vh3.com
 
  ns_param  address        127.0.0.1
 
 
 
  ns_section ns/server/www.vh3.com/module/nslog
 
   ns_param  file           /var/log/vh3/access.log
 
 
 
  ns_section ns/server/www.vh3.com/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/www.vh3.com/modules"
 
  ns_param  nssock            nssock.so
 
  ns_param  nslog              nslog.so
 
  ns_param  nscgi              nscgi.so
 

Latest revision as of 13:01, 28 December 2011

Virtual Hosts Configuration

part of AOLserver Config Examples

This config provides HTTP 1.1 style virtual hosts.

nssock is loaded globally and configured to map domain names to virtual servers.

Each virtual server then loads and configures any modules it needs. In this case just nslog for access logs.

 # Global Parameters
 ns_section ns/parameters
 ns_param home /usr/lib/aolserver4
 ns_param servername "Main AOLserver Process"
 ns_param serverlog /var/log/aolserver4/virtual-hosts.log
 ns_param pidfile /var/run/aolserver4/virtual-hosts.pid
 ns_section ns/servers
 ns_param   server1 "Website 1"
 ns_param   server2 "Website 2" 
 # Load nssock
 ns_section ns/modules
 ns_param   nssock             nssock.so
 # Configure nssock
 ns_section ns/module/nssock
 ns_param   port            80
 ns_param   address         127.0.0.1
 ns_param   defaultserver   server1
 # Map hostnames to virtual servers
 ns_section ns/module/nssock/servers
   ns_param server1 example1.com
   ns_param server2 example2.com
 # virtual server 1 
 ns_section ns/server/server1
 ns_param   directoryfile   index.html
 ns_param   pageroot        /var/www/example1.com
 # modules for server1
 ns_section ns/server/server1/modules
   ns_param   nslog         nslog.so
 # Configure server1 accesslog
 ns_section ns/server/server1/module/nslog
 ns_param   file            /var/log/aolserver4/example1.com.access.log
 # virtual server2 
 ns_section ns/server/server2
 ns_param   directoryfile   index.html
 ns_param   pageroot        /var/www/example2.com
 ns_section ns/server/server2/modules
 ns_param   nslog         nslog.so
 ns_section ns/server/server2/module/nslog
 ns_param   file         /var/log/aolserver4/example2.com.access.log