2 .. GENERATED by help2rst.py. DO NOT EDIT DIRECTLY.
12 **nghttpx** [OPTIONS]... [<PRIVATE_KEY> <CERT>]
17 A reverse proxy for HTTP/2, HTTP/1 and SPDY.
19 .. describe:: <PRIVATE_KEY>
22 Set path to server's private key. Required unless :option:`-p`\,
23 :option:`--client` or :option:`\--frontend-no-tls` are given.
27 Set path to server's certificate. Required unless :option:`-p`\,
28 :option:`--client` or :option:`\--frontend-no-tls` are given. To make OCSP
29 stapling work, this must be absolute path.
35 The options are categorized into several groups.
40 .. option:: -b, --backend=<HOST,PORT>
42 Set backend host and port. The multiple backend
43 addresses are accepted by repeating this option. UNIX
44 domain socket can be specified by prefixing path name
45 with "unix:" (e.g., unix:/var/run/backend.sock)
47 Default: ``127.0.0.1,80``
49 .. option:: -f, --frontend=<HOST,PORT>
51 Set frontend host and port. If <HOST> is '\*', it
52 assumes all addresses including both IPv4 and IPv6.
53 UNIX domain socket can be specified by prefixing path
54 name with "unix:" (e.g., unix:/var/run/nghttpx.sock)
58 .. option:: --backlog=<N>
60 Set listen backlog size.
64 .. option:: --backend-ipv4
66 Resolve backend hostname to IPv4 address only.
68 .. option:: --backend-ipv6
70 Resolve backend hostname to IPv6 address only.
72 .. option:: --backend-http-proxy-uri=<URI>
74 Specify proxy URI in the form
75 http://[<USER>:<PASS>@]<PROXY>:<PORT>. If a proxy
76 requires authentication, specify <USER> and <PASS>.
77 Note that they must be properly percent-encoded. This
78 proxy is used when the backend connection is HTTP/2.
79 First, make a CONNECT request to the proxy and it
80 connects to the backend on behalf of nghttpx. This
81 forms tunnel. After that, nghttpx performs SSL/TLS
82 handshake with the downstream through the tunnel. The
83 timeouts when connecting and making CONNECT request can
84 be specified by :option:`--backend-read-timeout` and
85 :option:`--backend-write-timeout` options.
91 .. option:: -n, --workers=<N>
93 Set the number of worker threads.
97 .. option:: --read-rate=<SIZE>
99 Set maximum average read rate on frontend connection.
100 Setting 0 to this option means read rate is unlimited.
104 .. option:: --read-burst=<SIZE>
106 Set maximum read burst size on frontend connection.
107 Setting 0 to this option means read burst size is
112 .. option:: --write-rate=<SIZE>
114 Set maximum average write rate on frontend connection.
115 Setting 0 to this option means write rate is unlimited.
119 .. option:: --write-burst=<SIZE>
121 Set maximum write burst size on frontend connection.
122 Setting 0 to this option means write burst size is
127 .. option:: --worker-read-rate=<SIZE>
129 Set maximum average read rate on frontend connection per
130 worker. Setting 0 to this option means read rate is
131 unlimited. Not implemented yet.
135 .. option:: --worker-read-burst=<SIZE>
137 Set maximum read burst size on frontend connection per
138 worker. Setting 0 to this option means read burst size
139 is unlimited. Not implemented yet.
143 .. option:: --worker-write-rate=<SIZE>
145 Set maximum average write rate on frontend connection
146 per worker. Setting 0 to this option means write rate
147 is unlimited. Not implemented yet.
151 .. option:: --worker-write-burst=<SIZE>
153 Set maximum write burst size on frontend connection per
154 worker. Setting 0 to this option means write burst size
155 is unlimited. Not implemented yet.
159 .. option:: --worker-frontend-connections=<N>
161 Set maximum number of simultaneous connections frontend
162 accepts. Setting 0 means unlimited.
166 .. option:: --backend-http2-connections-per-worker=<N>
168 Set maximum number of HTTP/2 connections per worker.
169 The default value is 0, which means the number of
170 backend addresses specified by :option:`-b` option.
172 .. option:: --backend-http1-connections-per-host=<N>
174 Set maximum number of backend concurrent HTTP/1
175 connections per host. This option is meaningful when :option:`-s`
176 option is used. To limit the number of connections per
177 frontend for default mode, use
178 :option:`--backend-http1-connections-per-frontend`\.
182 .. option:: --backend-http1-connections-per-frontend=<N>
184 Set maximum number of backend concurrent HTTP/1
185 connections per frontend. This option is only used for
186 default mode. 0 means unlimited. To limit the number
187 of connections per host for HTTP/2 or SPDY proxy mode
188 (-s option), use :option:`--backend-http1-connections-per-host`\.
192 .. option:: --rlimit-nofile=<N>
194 Set maximum number of open files (RLIMIT_NOFILE) to <N>.
195 If 0 is given, nghttpx does not set the limit.
199 .. option:: --backend-request-buffer=<SIZE>
201 Set buffer size used to store backend request.
205 .. option:: --backend-response-buffer=<SIZE>
207 Set buffer size used to store backend response.
215 .. option:: --frontend-http2-read-timeout=<DURATION>
217 Specify read timeout for HTTP/2 and SPDY frontend
222 .. option:: --frontend-read-timeout=<DURATION>
224 Specify read timeout for HTTP/1.1 frontend connection.
228 .. option:: --frontend-write-timeout=<DURATION>
230 Specify write timeout for all frontend connections.
234 .. option:: --stream-read-timeout=<DURATION>
236 Specify read timeout for HTTP/2 and SPDY streams. 0
241 .. option:: --stream-write-timeout=<DURATION>
243 Specify write timeout for HTTP/2 and SPDY streams. 0
248 .. option:: --backend-read-timeout=<DURATION>
250 Specify read timeout for backend connection.
254 .. option:: --backend-write-timeout=<DURATION>
256 Specify write timeout for backend connection.
260 .. option:: --backend-keep-alive-timeout=<DURATION>
262 Specify keep-alive timeout for backend connection.
266 .. option:: --listener-disable-timeout=<DURATION>
268 After accepting connection failed, connection listener
269 is disabled for a given amount of time. Specifying 0
270 disables this feature.
278 .. option:: --ciphers=<SUITE>
280 Set allowed cipher list. The format of the string is
281 described in OpenSSL ciphers(1).
283 .. option:: -k, --insecure
285 Don't verify backend server's certificate if :option:`-p`\,
286 :option:`--client` or :option:`\--http2-bridge` are given and
287 :option:`--backend-no-tls` is not given.
289 .. option:: --cacert=<PATH>
291 Set path to trusted CA certificate file if :option:`-p`\, :option:`--client`
292 or :option:`--http2-bridge` are given and :option:`\--backend-no-tls` is not
293 given. The file must be in PEM format. It can contain
294 multiple certificates. If the linked OpenSSL is
295 configured to load system wide certificates, they are
296 loaded at startup regardless of this option.
298 .. option:: --private-key-passwd-file=<PATH>
300 Path to file that contains password for the server's
301 private key. If none is given and the private key is
302 password protected it'll be requested interactively.
304 .. option:: --subcert=<KEYPATH>:<CERTPATH>
306 Specify additional certificate and private key file.
307 nghttpx will choose certificates based on the hostname
308 indicated by client using TLS SNI extension. This
309 option can be used multiple times. To make OCSP
310 stapling work, <CERTPATH> must be absolute path.
312 .. option:: --backend-tls-sni-field=<HOST>
314 Explicitly set the content of the TLS SNI extension.
315 This will default to the backend HOST name.
317 .. option:: --dh-param-file=<PATH>
319 Path to file that contains DH parameters in PEM format.
320 Without this option, DHE cipher suites are not
323 .. option:: --npn-list=<LIST>
325 Comma delimited list of ALPN protocol identifier sorted
326 in the order of preference. That means most desirable
327 protocol comes first. This is used in both ALPN and
328 NPN. The parameter must be delimited by a single comma
329 only and any white spaces are treated as a part of
332 Default: ``h2,h2-16,h2-14,spdy/3.1,http/1.1``
334 .. option:: --verify-client
336 Require and verify client certificate.
338 .. option:: --verify-client-cacert=<PATH>
340 Path to file that contains CA certificates to verify
341 client certificate. The file must be in PEM format. It
342 can contain multiple certificates.
344 .. option:: --client-private-key-file=<PATH>
346 Path to file that contains client private key used in
347 backend client authentication.
349 .. option:: --client-cert-file=<PATH>
351 Path to file that contains client certificate used in
352 backend client authentication.
354 .. option:: --tls-proto-list=<LIST>
356 Comma delimited list of SSL/TLS protocol to be enabled.
357 The following protocols are available: TLSv1.2, TLSv1.1
358 and TLSv1.0. The name matching is done in
359 case-insensitive manner. The parameter must be
360 delimited by a single comma only and any white spaces
361 are treated as a part of protocol string.
363 Default: ``TLSv1.2,TLSv1.1``
365 .. option:: --tls-ticket-key-file=<PATH>
367 Path to file that contains 48 bytes random data to
368 construct TLS session ticket parameters. This options
369 can be used repeatedly to specify multiple ticket
370 parameters. If several files are given, only the first
371 key is used to encrypt TLS session tickets. Other keys
372 are accepted but server will issue new session ticket
373 with first key. This allows session key rotation.
374 Please note that key rotation does not occur
375 automatically. User should rearrange files or change
376 options values and restart nghttpx gracefully. If
377 opening or reading given file fails, all loaded keys are
378 discarded and it is treated as if none of this option is
379 given. If this option is not given or an error occurred
380 while opening or reading a file, key is generated
381 automatically and renewed every 12hrs. At most 2 keys
382 are stored in memory.
384 .. option:: --fetch-ocsp-response-file=<PATH>
386 Path to fetch-ocsp-response script file. It should be
389 Default: ``/usr/local/share/nghttp2/fetch-ocsp-response``
391 .. option:: --ocsp-update-interval=<DURATION>
393 Set interval to update OCSP response cache.
397 .. option:: --no-ocsp
399 Disable OCSP stapling.
405 .. option:: -c, --http2-max-concurrent-streams=<N>
407 Set the maximum number of the concurrent streams in one
408 HTTP/2 and SPDY session.
412 .. option:: --frontend-http2-window-bits=<N>
414 Sets the per-stream initial window size of HTTP/2 SPDY
415 frontend connection. For HTTP/2, the size is 2\*\*<N>-1.
416 For SPDY, the size is 2\*\*<N>.
420 .. option:: --frontend-http2-connection-window-bits=<N>
422 Sets the per-connection window size of HTTP/2 and SPDY
423 frontend connection. For HTTP/2, the size is
424 2**<N>-1. For SPDY, the size is 2\*\*<N>.
428 .. option:: --frontend-no-tls
430 Disable SSL/TLS on frontend connections.
432 .. option:: --backend-http2-window-bits=<N>
434 Sets the initial window size of HTTP/2 backend
435 connection to 2\*\*<N>-1.
439 .. option:: --backend-http2-connection-window-bits=<N>
441 Sets the per-connection window size of HTTP/2 backend
442 connection to 2\*\*<N>-1.
446 .. option:: --backend-no-tls
448 Disable SSL/TLS on backend connections.
450 .. option:: --http2-no-cookie-crumbling
452 Don't crumble cookie header field.
454 .. option:: --padding=<N>
456 Add at most <N> bytes to a HTTP/2 frame payload as
457 padding. Specify 0 to disable padding. This option is
458 meant for debugging purpose and not intended to enhance
461 .. option:: --no-server-push
463 Disable HTTP/2 server push. Server push is only
464 supported by default mode and HTTP/2 frontend. SPDY
465 frontend does not support server push.
471 .. describe:: (default mode)
474 Accept HTTP/2, SPDY and HTTP/1.1 over SSL/TLS. If
475 :option:`--frontend-no-tls` is used, accept HTTP/2 and HTTP/1.1.
476 The incoming HTTP/1.1 connection can be upgraded to
477 HTTP/2 through HTTP Upgrade. The protocol to the
480 .. option:: -s, --http2-proxy
482 Like default mode, but enable secure proxy mode.
484 .. option:: --http2-bridge
486 Like default mode, but communicate with the backend in
487 HTTP/2 over SSL/TLS. Thus the incoming all connections
488 are converted to HTTP/2 connection and relayed to the
489 backend. See :option:`--backend-http-proxy-uri` option if you are
490 behind the proxy and want to connect to the outside
495 Accept HTTP/2 and HTTP/1.1 without SSL/TLS. The
496 incoming HTTP/1.1 connection can be upgraded to HTTP/2
497 connection through HTTP Upgrade. The protocol to the
498 backend is HTTP/2. To use nghttpx as a forward proxy,
499 use :option:`-p` option instead.
501 .. option:: -p, --client-proxy
503 Like :option:`--client` option, but it also requires the request
504 path from frontend must be an absolute URI, suitable for
505 use as a forward proxy.
511 .. option:: -L, --log-level=<LEVEL>
513 Set the severity level of log output. <LEVEL> must be
514 one of INFO, NOTICE, WARN, ERROR and FATAL.
518 .. option:: --accesslog-file=<PATH>
520 Set path to write access log. To reopen file, send USR1
523 .. option:: --accesslog-syslog
525 Send access log to syslog. If this option is used,
526 :option:`--accesslog-file` option is ignored.
528 .. option:: --accesslog-format=<FORMAT>
530 Specify format string for access log. The default
531 format is combined format. The following variables are
534 * $remote_addr: client IP address.
535 * $time_local: local time in Common Log format.
536 * $time_iso8601: local time in ISO 8601 format.
537 * $request: HTTP request line.
538 * $status: HTTP response status code.
539 * $body_bytes_sent: the number of bytes sent to client
541 * $http_<VAR>: value of HTTP request header <VAR> where
542 '_' in <VAR> is replaced with '-'.
543 * $remote_port: client port.
544 * $server_port: server port.
545 * $request_time: request processing time in seconds with
546 milliseconds resolution.
547 * $pid: PID of the running process.
548 * $alpn: ALPN identifier of the protocol which generates
549 the response. For HTTP/1, ALPN is always http/1.1,
550 regardless of minor version.
553 Default: ``$remote_addr - - [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"``
555 .. option:: --errorlog-file=<PATH>
557 Set path to write error log. To reopen file, send USR1
558 signal to nghttpx. stderr will be redirected to the
559 error log file unless :option:`--errorlog-syslog` is used.
561 Default: ``/dev/stderr``
563 .. option:: --errorlog-syslog
565 Send error log to syslog. If this option is used,
566 :option:`--errorlog-file` option is ignored.
568 .. option:: --syslog-facility=<FACILITY>
570 Set syslog facility to <FACILITY>.
578 .. option:: --add-x-forwarded-for
580 Append X-Forwarded-For header field to the downstream
583 .. option:: --strip-incoming-x-forwarded-for
585 Strip X-Forwarded-For header field from inbound client
590 Don't append to Via header field. If Via header field
591 is received, it is left unaltered.
593 .. option:: --no-location-rewrite
595 Don't rewrite location header field on :option:`--http2-bridge`\,
596 :option:`--client` and default mode. For :option:`\--http2-proxy` and
597 :option:`--client-proxy` mode, location header field will not be
598 altered regardless of this option.
600 .. option:: --no-host-rewrite
602 Don't rewrite host and :authority header fields on
603 :option:`--http2-bridge`\, :option:`--client` and default mode. For
604 :option:`--http2-proxy` and :option:`\--client-proxy` mode, these headers
605 will not be altered regardless of this option.
607 .. option:: --altsvc=<PROTOID,PORT[,HOST,[ORIGIN]]>
609 Specify protocol ID, port, host and origin of
610 alternative service. <HOST> and <ORIGIN> are optional.
611 They are advertised in alt-svc header field only in
612 HTTP/1.1 frontend. This option can be used multiple
613 times to specify multiple alternative services.
614 Example: :option:`--altsvc`\=h2,443
616 .. option:: --add-response-header=<HEADER>
618 Specify additional header field to add to response
619 header set. This option just appends header field and
620 won't replace anything already set. This option can be
621 used several times to specify multiple header fields.
622 Example: :option:`--add-response-header`\="foo: bar"
624 .. option:: --header-field-buffer=<SIZE>
626 Set maximum buffer size for incoming HTTP header field
627 list. This is the sum of header name and value in
632 .. option:: --max-header-fields=<N>
634 Set maximum number of incoming HTTP header fields, which
635 appear in one request or response header field list.
643 .. option:: --frontend-http2-dump-request-header=<PATH>
645 Dumps request headers received by HTTP/2 frontend to the
646 file denoted in <PATH>. The output is done in HTTP/1
647 header field format and each header block is followed by
648 an empty line. This option is not thread safe and MUST
649 NOT be used with option :option:`-n`\<N>, where <N> >= 2.
651 .. option:: --frontend-http2-dump-response-header=<PATH>
653 Dumps response headers sent from HTTP/2 frontend to the
654 file denoted in <PATH>. The output is done in HTTP/1
655 header field format and each header block is followed by
656 an empty line. This option is not thread safe and MUST
657 NOT be used with option :option:`-n`\<N>, where <N> >= 2.
659 .. option:: -o, --frontend-frame-debug
661 Print HTTP/2 frames in frontend to stderr. This option
662 is not thread safe and MUST NOT be used with option
663 :option:`-n`\=N, where N >= 2.
669 .. option:: -D, --daemon
671 Run in a background. If :option:`-D` is used, the current working
672 directory is changed to '*/*'.
674 .. option:: --pid-file=<PATH>
676 Set path to save PID of this program.
678 .. option:: --user=<USER>
680 Run this program as <USER>. This option is intended to
681 be used to drop root privileges.
687 .. option:: --conf=<PATH>
689 Load configuration from <PATH>.
691 Default: ``/etc/nghttpx/nghttpx.conf``
693 .. option:: -v, --version
695 Print version and exit.
697 .. option:: -h, --help
699 Print this help and exit.
703 The <SIZE> argument is an integer and an optional unit (e.g., 10K is
704 10 * 1024). Units are K, M and G (powers of 1024).
706 The <DURATION> argument is an integer and an optional unit (e.g., 1s
707 is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms
708 (hours, minutes, seconds and milliseconds, respectively). If a unit
709 is omitted, a second is used as unit.
714 */etc/nghttpx/nghttpx.conf*
715 The default configuration file path nghttpx searches at startup.
716 The configuration file path can be changed using :option:`--conf`
719 Those lines which are staring ``#`` are treated as comment.
721 The option name in the configuration file is the long command-line
722 option name with leading ``--`` stripped (e.g., ``frontend``). Put
723 ``=`` between option name and value. Don't put extra leading or
726 The options which do not take argument in the command-line *take*
727 argument in the configuration file. Specify ``yes`` as an argument
728 (e.g., ``http2-proxy=yes``). If other string is given, it is
731 To specify private key and certificate file which are given as
732 positional arguments in command-line, use ``private-key-file`` and
733 ``certificate-file``.
735 :option:`--conf` option cannot be used in the configuration file and
736 will be ignored if specified.
742 Shutdown gracefully. First accept pending connections and stop
743 accepting connection. After all connections are handled, nghttpx
750 Fork and execute nghttpx. It will execute the binary in the same
751 path with same command-line arguments and environment variables.
752 After new process comes up, sending SIGQUIT to the original process
753 to perform hot swapping.
758 nghttpx supports HTTP/2 server push in default mode. nghttpx looks
759 for Link header field (`RFC 5988
760 <http://tools.ietf.org/html/rfc5988>`_) in response headers from
761 backend server and extracts URI-reference with parameter
762 ``rel=preload`` (see `preload
763 <http://w3c.github.io/preload/#interoperability-with-http-link-header>`_)
764 and pushes those URIs to the frontend client. Here is a sample Link
765 header field to initiate server push:
769 Link: </fonts/font.woff>; rel=preload
770 Link: </css/theme.css>; rel=preload
772 Currently, the following restrictions are applied for server push:
774 1. URI-reference must not contain authority. If it exists, it is not
775 pushed. ``/fonts/font.woff`` and ``css/theme.css`` are eligible to
776 be pushed. ``https://example.org/fonts/font.woff`` and
777 ``//example.org/css/theme.css`` are not.
779 2. The associated stream must have method "GET" or "POST". The
780 associated stream's status code must be 200.
782 These limitations may be loosened in the future release.
787 nghttpx supports UNIX domain socket with a filename for both frontend
788 and backend connections.
790 Please note that current nghttpx implementation does not delete a
791 socket with a filename. And on start up, if nghttpx detects that the
792 specified socket already exists in the file system, nghttpx first
793 deletes it. However, if SIGUSR2 is used to execute new binary and
794 both old and new configurations use same filename, new binary does not
795 delete the socket and continues to use it.
800 OCSP query is done using external perl script ``fetch-ocsp-response``,
801 which has been developed as part of h2o project
802 (https://github.com/h2o/h2o).
804 The script file is usually installed under
805 ``$(prefix)/share/nghttp2/`` directory. The actual path to script can
806 be customized using :option:`--fetch-ocsp-response-file` option.
811 :manpage:`nghttp(1)`, :manpage:`nghttpd(1)`, :manpage:`h2load(1)`