docs: Add missing proxy and fastcgi options (#108)

* docs: Add missing proxy and fastcgi options

* Update src/docs/markdown/caddyfile/directives/reverse_proxy.md

Co-authored-by: Matt Holt <mholt@users.noreply.github.com>

* Update src/docs/markdown/caddyfile/directives/reverse_proxy.md

Co-authored-by: Matt Holt <mholt@users.noreply.github.com>

* Update src/docs/markdown/caddyfile/directives/reverse_proxy.md

Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
This commit is contained in:
Francis Lavoie 2020-11-24 17:19:46 -05:00 committed by GitHub
parent e20ab56bf2
commit bc64f3acc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 10 deletions

View file

@ -18,20 +18,29 @@ It supports all the subdirectives of [reverse_proxy](/docs/caddyfile/directives/
```caddy-d ```caddy-d
php_fastcgi [<matcher>] <php-fpm_gateways...> { php_fastcgi [<matcher>] <php-fpm_gateways...> {
root <path>
split <substrings...> split <substrings...>
env [<key> <value>] env [<key> <value>]
root <path>
index <filename> index <filename>
resolve_root_symlink
dial_timeout <duration>
read_timeout <duration>
write_timeout <duration>
<any other reverse_proxy subdirectives...> <any other reverse_proxy subdirectives...>
} }
``` ```
- **<php-fpm_gateways...>** are the [addresses](/docs/conventions#network-addresses) of the FastCGI servers. - **<php-fpm_gateways...>** are the [addresses](/docs/conventions#network-addresses) of the FastCGI servers.
- **split** sets the substrings for splitting the URI into two parts. The first matching substring will be used to split the "path info" from the path. The first piece is suffixed with the matching substring and will be assumed as the actual resource (CGI script) name. The second piece will be set to PATH_INFO for the CGI script to use. Default: `.php`
- **env** sets an extra environment variable to the given value.
- **root** sets the root folder to the site. Default: [`root` directive](/docs/caddyfile/directives/root). - **root** sets the root folder to the site. Default: [`root` directive](/docs/caddyfile/directives/root).
- **split** sets the substrings for splitting the URI into two parts. The first matching substring will be used to split the "path info" from the path. The first piece is suffixed with the matching substring and will be assumed as the actual resource (CGI script) name. The second piece will be set to PATH_INFO for the CGI script to use. Default: `.php`
- **env** sets an extra environment variable to the given value. Can be specified more than once for multiple environment variables.
- **index** specifies the filename to treat as the directory index file. This affects the file matcher in the [expanded form](#expanded-form). Default: `index.php` - **index** specifies the filename to treat as the directory index file. This affects the file matcher in the [expanded form](#expanded-form). Default: `index.php`
- **resolve_root_symlink** enables resolving the `root` directory to its actual value by evaluating a symbolic link, if one exists.
- **dial_timeout** is how long to wait when connecting to the upstream socket. Accepts [duration values](/docs/conventions#durations). Default: no timeout.
- **read_timeout** is how long to wait when reading from the FastCGI server. Accepts [duration values](/docs/conventions#durations). Default: no timeout.
- **write_timeout** is how long to wait when sending to the FastCGI server. Accepts [duration values](/docs/conventions#durations). Default: no timeout.
Since this directive is an opinionated wrapper over a reverse proxy, you can use any of reverse_proxy's subdirectives to customize it. Since this directive is an opinionated wrapper over a reverse proxy, you can use any of reverse_proxy's subdirectives to customize it.

View file

@ -135,13 +135,18 @@ Caddy's proxy **transport** is pluggable:
- **transport** defines how to communicate with the backend. Default is `http`. - **transport** defines how to communicate with the backend. Default is `http`.
#### The `http` transport #### The `http` transport
```caddy-d ```caddy-d
transport http { transport http {
read_buffer <size> read_buffer <size>
write_buffer <size> write_buffer <size>
dial_timeout <duration> max_response_header <size>
dial_timeout <duration>
dial_fallback_delay <duration>
response_header_timeout <duration>
expect_continue_timeout <duration>
tls tls
tls_client_auth <automate_name> | <cert_file> <key_file> tls_client_auth <automate_name> | <cert_file> <key_file>
tls_insecure_skip_verify tls_insecure_skip_verify
@ -159,7 +164,11 @@ transport http {
- **read_buffer** is the size of the read buffer in bytes. - **read_buffer** is the size of the read buffer in bytes.
- **write_buffer** is the size of the write buffer in bytes. - **write_buffer** is the size of the write buffer in bytes.
- **dial_timeout** is how long to wait when connecting to the upstream socket. - **max_response_header** is the maximum amount of bytes to read from response headers.
- **dial_timeout** is how long to wait when connecting to the upstream socket. Accepts [duration values](/docs/conventions#durations).
- **dial_fallback_delay** is how long to wait before spawning an RFC 6555 Fast Fallback connection. A negative value disables this. Accepts [duration values](/docs/conventions#durations).
- **response_header_timeout** is how long to wait for reading response headers from the upstream. Accepts [duration values](/docs/conventions#durations).
- **expect_continue_timeout** is how long to wait for the upstreams's first response headers after fully writing the request headers if the request has the header `Expect: 100-continue`. Accepts [duration values](/docs/conventions#durations).
- **tls** uses HTTPS with the backend. This will be enabled automatically if you specify backends using the `https://` scheme or port `:443`. - **tls** uses HTTPS with the backend. This will be enabled automatically if you specify backends using the `https://` scheme or port `:443`.
- **tls_client_auth** enables TLS client authentication one of two ways: (1) by specifying a domain name for which Caddy should obtain a certificate and keep it renewed, or (2) by specifying a certificate and key file to present for TLS client authentication with the backend. - **tls_client_auth** enables TLS client authentication one of two ways: (1) by specifying a domain name for which Caddy should obtain a certificate and keep it renewed, or (2) by specifying a certificate and key file to present for TLS client authentication with the backend.
- **tls_insecure_skip_verify** turns off security. _Do not use in production._ - **tls_insecure_skip_verify** turns off security. _Do not use in production._
@ -173,6 +182,8 @@ transport http {
- **max_conns_per_host** optionally limits the total number of connections per host, including connections in the dialing, active, and idle states. Has no limit by default. - **max_conns_per_host** optionally limits the total number of connections per host, including connections in the dialing, active, and idle states. Has no limit by default.
- **max_idle_conns_per_host** if non-zero, controls the maximum idle (keepalive) connections to keep per-host. Default: `2` - **max_idle_conns_per_host** if non-zero, controls the maximum idle (keepalive) connections to keep per-host. Default: `2`
#### The `fastcgi` transport #### The `fastcgi` transport
```caddy-d ```caddy-d
@ -180,14 +191,20 @@ transport fastcgi {
root <path> root <path>
split <at> split <at>
env <key> <value> env <key> <value>
resolve_root_symlink resolve_root_symlink
dial_timeout <duration>
read_timeout <duration>
write_timeout <duration>
} }
``` ```
- **root** is the root of the site. Default: `{http.vars.root}` or current working directory. - **root** is the root of the site. Default: `{http.vars.root}` or current working directory.
- **split** is where to split the path to get PATH_INFO at the end of the URI. - **split** is where to split the path to get PATH_INFO at the end of the URI.
- **env** sets custom environment variables. - **env** sets an extra environment variable to the given value. Can be specified more than once for multiple environment variables.
- **resolve_root_symlink** The declared root directory will be resolved to its actual value by evaluating any symbolic links. - **resolve_root_symlink** enables resolving the `root` directory to its actual value by evaluating a symbolic link, if one exists.
- **dial_timeout** is how long to wait when connecting to the upstream socket. Accepts [duration values](/docs/conventions#durations). Default: no timeout.
- **read_timeout** is how long to wait when reading from the FastCGI server. Accepts [duration values](/docs/conventions#durations). Default: no timeout.
- **write_timeout** is how long to wait when sending to the FastCGI server. Accepts [duration values](/docs/conventions#durations). Default: no timeout.
## Examples ## Examples