mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-23 15:31:40 -04:00
Minor changes; added WebSocket and proxy docs
parent
8702b5154e
commit
540491f2d2
@ -7,7 +7,7 @@ This list is presented alphabetically. The order in which directives appear in t
|
||||
|
||||
#### cpu
|
||||
|
||||
Limits use of processor cores to the number (or percentage) specified. By default, all cores may be used to serve requests. This directive is actually process-wide, meaning that it applies to ALL servers started with the same instance of `caddy`. If specified multiple times, the highest value is used. Can be a number (at least 1) or a percent (between 1% and 100%).
|
||||
Caps the CPU use to the number of cores (or percentage) specified. By default, all cores may be used to serve requests. This directive is actually process-wide, meaning that it applies to ALL servers started with the same `caddy` process. If specified multiple times in a Caddyfile, the highest value is used. Can be a number of cores (at least 1) or a percent (between 1% and 100%).
|
||||
|
||||
```
|
||||
cpu 50%
|
||||
@ -43,7 +43,7 @@ fastcgi /app 127.0.0.1:9000
|
||||
|
||||
#### header
|
||||
|
||||
Adds header(s) of the specified name and value to the responses of requests matching the request path. You can specify a single header and value on a line or group them under the same path with curly braces. You can use this directive multiple times.
|
||||
Adds header(s) of the specified name and value to the responses of requests matching the request path. You can specify a single header and value on a line or group them under the same path with curly braces.
|
||||
|
||||
```
|
||||
header /one X-Some-Header 1
|
||||
@ -55,7 +55,7 @@ header /multiple {
|
||||
|
||||
#### import
|
||||
|
||||
Import acts like "include" in other languages/syntaxes. It replaces that line with the contents of another file. Useful for reusing common settings. You can use this directive multiple times.
|
||||
Import acts like "include" in other languages/syntaxes. It replaces that line with the contents of another file. Useful for reusing common settings.
|
||||
|
||||
```
|
||||
import shared.conf
|
||||
@ -64,13 +64,13 @@ import shared.conf
|
||||
|
||||
#### log
|
||||
|
||||
Activates logging. Right now, only requests can be logged. You may optionally specify an output file and format. You can use this directive multiple times.
|
||||
Activates logging. Right now, only requests can be logged. You may optionally specify an output file and format.
|
||||
|
||||
```
|
||||
log requests /var/log/access.log "Got a request: {method} {path}"
|
||||
```
|
||||
|
||||
To specify a format but use the default filename, use `_` as the filename (Go-style). The filename can also be `stdout` or `stderr` instead of an actual file.
|
||||
To specify a format but use the default filename, use `_` as the filename (like Go's blank identifier). The filename can also be "stdout" or "stderr" instead of an actual file.
|
||||
|
||||
The following variables are available when specifying the format:
|
||||
|
||||
@ -88,9 +88,19 @@ The following variables are available when specifying the format:
|
||||
- {status}
|
||||
- {size}
|
||||
|
||||
|
||||
#### proxy
|
||||
|
||||
A simple reverse proxy. (This capability is slated for expansion soon.) Right now, it simply forwards a request matching the first argument to the second argument.
|
||||
|
||||
```
|
||||
proxy /from http://example.com/to
|
||||
```
|
||||
|
||||
|
||||
#### redirect
|
||||
|
||||
HTTP redirect with the given status code. You can use this directive multiple times.
|
||||
HTTP redirect with the given status code.
|
||||
|
||||
```
|
||||
redirect /from /to 302
|
||||
@ -99,7 +109,7 @@ redirect /from /to 302
|
||||
|
||||
#### rewrite
|
||||
|
||||
Internally rewrites a request from one path to another. You can use this directive multiple times.
|
||||
Internally rewrites a request from one path to another.
|
||||
|
||||
```
|
||||
rewrite /from /to
|
||||
@ -117,8 +127,17 @@ root /usr/www
|
||||
|
||||
#### tls
|
||||
|
||||
Enables TLS (better than plain SSL) using the specified certificate and key files.
|
||||
Enables TLS (for HTTPS connections) using the specified certificate and key files.
|
||||
|
||||
```
|
||||
tls cert.pem key.pem
|
||||
```
|
||||
|
||||
|
||||
#### websocket
|
||||
|
||||
Configures a WebSocket endpoint which runs the specified command. Each connection starts a separate process, so they are isolated from each other. The `stdin` and `stdout` of the running process are set to the web socket connection, so the client can communicate with the program directly. Environment variables are set for the running process according to the CGI 1.1 spec. You may specify multiple websocket endpoints.
|
||||
|
||||
```
|
||||
websocket /echo cat
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user