NaviServer - programmable web server

[ Main Table Of Contents | Table Of Contents | Keyword Index ]

# nssock(n) 4.99.8 nssock "NaviServer Module Commands"

## Name

nssock - Configuring http socket communications

## Table Of Contents

## Description

This module nssock is used for the socket communication for http. For the communication via https, the module nsssl is used, which shares the configuration parameters presented here and adds additional parameters.

The module nssock is typically loaded per server, e.g. for server1:

       ns_section ns/server/server1/modules
       ns_param   nssock   nssock.so

       ns_section ns/server/server1/module/nssock
       ns_param port 8000
       ...

This amount of configuration is sufficient for many installations, which do not want to run the server on port 80 (which requires as well root permissions for starting).

## CONFIGURATION

The module nssock provides a rich set of configuration options, which are important for large installation. However, all parameters are equipped with sensible default values, such that none of these are required.

acceptsize

  Maximum number of requests accepted at once (integer, defaults to the value backlog)

address

  IP-Address on which the server should listen (default: 0.0.0.0)

backlog

  Maximum number of entries for waiting listen connections (integer, default: 256)

bufsize

  Maximum size in bytes (octets) for a single receive operation (integer, 16384)

closewait

  Timeout in seconds for close on socket to drain potential garbage if no keep alive is performed. (integer, default: 2)

defaultserver

  When virtual servers are defined, this refers to the default server (the server, receiving all urls not mapped to a specific server)

deferaccept

  TCP Performance option; use TCP_FASTOPEN or TCP_DEFER_ACCEPT or SO_ACCEPTFILTER, whatever is available in your operating system to improve the performance of the initial TCP 3-way handshake. The capabilities of the operating system are determined at compile time. If you want to use TCP_FASTOPEN (introduced by Linux kernel 3.7.0), you might have to activate this option in your kernel, by using

         sudo sysctl net.ipv4.tcp_fastopen=1

  (boolean, default: false)

hostname

  Hostname of the server, can be looked up automatically if not specified.

keepalivemaxdownloadsize

  Don't allow keep-alive for downloads content larger than this size in bytes; a value of 0 means that this feature is deactivated (integer, default 0)

keepalivemaxuploadsize

  Don't allow keep-alive for upload content larger than this size in bytes; a value of 0 means that this feature is deactivated (integer, default 0)

keepwait

  Timeout in seconds for keep-alive. (integer, default: 5)

location

  Provide a default for protocol://hostname[:port]. Useful for virtual servers.

maxheaders

  Maximum number of header lines (integer, 128)

maxinput

  Maximum size in bytes (octets) for content loaded into the server, such as upload of files. (integer, default: 1048576)

maxline

  Maximum size in bytes (octets) of a single header line (integer, default: 8192)

maxqueuesize

  Size of the queue of accepted requests waiting for a connection thread (integer, default 1024).

maxupload

  When spooler threads are activated, use spooler threads for uploads larger than this size in bytes (see as well spoolerthreads)

nodelay

  TCP Performance option; use TCP_NODELAY (OS-default on Linux). (boolean, default: false)

port

  Port, on which the server listens. When the port is specified as 0, the module with its defined commands (such as ns_http is loaded, but the driver will not be listening on any port. (integer, default: 80)

extraheaders

  This parameter can be used to add extra response headers for every reponse sent over this driver. The extraheaders have the form for attribute/value pairs. This mechanism can be used to implement for example HTTP Strict Transport Security in nsssl, which uses the same parameter definition.

readahead

  Maximum size in bytes (octets) for asynchronous read ahead operations (integer, defaults to bufsize)

recvwait

  Timeout in seconds for receive operations. (integer, default: 30)

sendwait

  Timeout in seconds for send operations. (integer, default: 30)

spoolerthreads

  Number of spooler threads, which spool uploads to a file rather than to memory; see as well maxupload (integer, default: 0)

uploadpath

  Directory for uploads, defaults to the setting of ns/parameter tmpdir.

writerbufsize

  Buffer size in bytes (octets) for writer threads (integer, default: 8192)

writersize

  Use writer threads for replies above this size. (integer, default: 1048576)

writerstreaming

  Use writer threads for streaming HTML output (e.g. ns_write ...). (boolean, default: false)

writerthreads

  Number of writer threads. (integer, default: 0)

## EXAMPLES

In case, one requires for one naviserver to listen on several ports, it is possible to load the nssock module twice with different names, here nssock1 and nssock2.

       ns_section ns/server/server1/modules
       ns_param   nssock1   nssock.so
       ns_param   nssock2   nssock.so

       ns_section ns/server/server1/module/nssock1
       ns_param   port    8000

       ns_section ns/server/server1/module/nssock2
       ns_param   port    8001

More to come here...

## See Also

ns_http, ns_log, ns_ssl, ns_write

## Keywords

TCP, TCP_FASTOPEN, configuration, driver, nssock, nsssl, performance, tuning