Where are the posts, suggesting that this is not possible? These were probably referring to AOLserver, which has much less flexibility in this regards than NaviServer.
NaviServer supports different means to run multiple servers from one configuration file in one nsd process:
- define multiple servers, and run all or some of these
- virtual hosting (direct requests to different servers based on the "host" header field)
I stick with the first option here, since this closer to your question. We start with a simple NaviServer configuration file,
containing two servers, named "s1" and "s2".
ns_section "ns/servers"
ns_param s1 "NaviServer Instance 1"
ns_param s2 "NaviServer Instance 1"
# ----------------------- Server s1 ------------------------------
ns_section "ns/server/s1/adp"
ns_param map /*.adp
ns_section "ns/server/s1/modules"
ns_param nssock nssock
ns_section "ns/server/s1/module/nssock"
ns_param address 0.0.0.0
ns_param port 8000
# ----------------------- Server s2 ------------------------------
ns_section "ns/server/s2/adp"
ns_param map /*.adp
ns_section "ns/server/s2/modules"
ns_param nssock nssock
ns_section "ns/server/s2/module/nssock"
ns_param address 0.0.0.0
ns_param port 8001
When NaviServer is started with the config file e.g. via /usr/local/ns/bin/nsd -u nsadmin -t two-server-config.tcl -f
, then the system log will contain the following lines.
...
[12/Apr/2019:12:35:20][39849.70000ee02000][-driver:nssock:0-] Notice: nssock:0: listening on [0.0.0.0]:8001
[12/Apr/2019:12:35:20][39849.70000ee85000][-driver:nssock:0-] Notice: nssock:0: listening on [0.0.0.0]:8000
[12/Apr/2019:12:35:20][39849.70000ed7f000][-conn:s2:0:0-] Notice: thread initialized (0.169447 secs)
[12/Apr/2019:12:35:20][39849.70000ecfc000][-conn:s1:0:0-] Notice: thread initialized (0.169740 secs)
...
This means that nsd is listening on two different ports, directing requests depending on the port to the two server instances (which are here configured identically). One might certainly wish to configure the server instances differently, e.g. to load the NaviServer blueprints from different sources and/or serve pages from different directories, etc. This can be achieved along the following lines:
#
# Load blueprint from the following directory
#
#ns_section "ns/server/s2/tcl"
#ns_param library /var/www/s2/tcl
#
# Serve pages from the following directory
#
#ns_section "ns/server/s2/fastpath"
#ns_param serverdir /var/www/s2
#ns_param page
In case, only one of these server should be started, one can use the flag "-server ..." to start e.g. only one of these servers.
/usr/local/ns/bin/nsd -u nsadmin -t two-server-config.tcl -f -server s1
A configuration based on virtual hosting means that the server is listing on one port for connections to many servers, but depending on the "host:" header field, requests are directed to one of the configured servers.
When using multiple NaviServer severs with OpenACS, the configuration files are usually more complex. The sample configuration files contain usually a Tcl variable "server", which is used for various purposes (name of server, name of directory, name of database, name of database user, ...). Certainly, this has to be demangled when someone wants to run multiple OpenACS instances at the same time, and one has to decide, what should be the same and what not.
In case, you want to run multiple OpenACS instances against the same database concurrently, expect problems, since one server instances might change the data in ways the other server instances might not expect (e.g. caching won't work).
Hope, this makes things clearer. So far it is not clear to me what you want to achieve.
-g