Configuration with PostgreSQL

https://web.archive.org/web/20161211211830/naviserver.sourceforge.net/ns_logobig.gif

MainHome Page Source Code Downloads API Documentation Mailing Lists Bugs Developers


This is an example Naviserver configuration file with PostgreSQL.

This example would require the following setup in PostgreSQL:

database: demo

user: nsd

password: nsd-password-123

set        homedir                /usr/lib/naviserver

set        server_name            alpha

set        address                192.168.1.128
set        port                   80


ns_section      "ns/server/${server_name}/modules"
   ns_param     nssock            ${homedir}/bin/nssock.so
   ns_param     nsdb              ${homedir}/bin/nsdb.so


ns_section      "ns/parameters"
   ns_param     home              $homedir


ns_section      "ns/servers"
   ns_param     $server_name      "Naviserver $server_name"


ns_section      "ns/server/${server_name}/fastpath"
   ns_param     pagedir           /var/www/alpha.co.uk/


ns_section      "ns/module/nssock"
   ns_param     port              $port
   ns_param     address           $address
   ns_param     defaultserver     $server_name


ns_section      "ns/module/nssock/servers"
   ns_param     $server_name      alpha.co.uk


ns_section      "ns/db/drivers"
   ns_param     postgres          ${homedir}/bin/nsdbpg.so


ns_section      "ns/db/pools"
   ns_param     main              "Main Pool"


ns_section      "ns/db/pool/main"
   ns_param     driver            postgres
   ns_param     datasource        127.0.0.1:5432:demo
   ns_param     user              nsd
   ns_param     password          "nsd-password-123"
   ns_param     connections       1


ns_section      "ns/server/${server_name}/db"
   ns_param     pools             "*"
   ns_param     defaultpool       "main"


ns_section      "ns/server/${server_name}/tcl"
   ns_param     library           /var/www/alpha.co.uk/tcl