配置文件 Caddyfile
Caddyfile的规范以及结构
在Caddyfile中
- 注释以 # 开头
- 环境变量,如:{$SITE_ADDRESS}
速记占位符 | 用于取代的占位符(等价) |
---|---|
{dir} | {http.request.uri.path.dir} |
{file} | {http.request.uri.path.file} |
{header.*} | {http.request.header.*} |
{host} | {http.request.host} |
{labels.*} | {http.request.host.labels.*} |
{hostport} | {http.request.hostport} |
{port} | {http.request.port} |
{method} | {http.request.method} |
{path} | {http.request.uri.path} |
{path.*} | {http.request.uri.path.*} |
{query} | {http.request.uri.query} |
{query.*} | {http.request.uri.query.*} |
{re..} | {http.regexp..} |
{remote} | {http.request.remote} |
{remote_host} | {http.request.remote.host} |
{remote_port} | {http.request.remote.port} |
{scheme} | {http.request.scheme} |
{uri} | {http.request.uri} |
{tls_cipher} | {http.request.tls.cipher_suite} |
{tls_version} | {http.request.tls.version} |
{tls_client_fingerprint} | {http.request.tls.client.fingerprint} |
{tls_client_issuer} | {http.request.tls.client.issuer} |
{tls_client_serial} | {http.request.tls.client.serial} |
{tls_client_subject} | {http.request.tls.client.subject} |
{tls_client_certificate_pem} | {http.request.tls.client.certificate_pem} |
{upstream_hostport} | {http.reverse_proxy.upstream.hostport} |
并非所有占位符在配置的所有部分都可用,哪些占位符可用取决于上下文。例如,HTTP应用程序设置的占位符仅在与处理HTTP请求相关的配置区域中可用。