mirror of
https://github.com/caddyserver/website.git
synced 2025-04-24 05:56:15 -04:00
Initial commit
This commit is contained in:
commit
03b6fddeb0
77 changed files with 7599 additions and 0 deletions
44
src/docs/markdown/caddyfile/directives/root.md
Normal file
44
src/docs/markdown/caddyfile/directives/root.md
Normal file
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
title: root (Caddyfile directive)
|
||||
---
|
||||
|
||||
# root
|
||||
|
||||
Sets the root path of the site, used by various matchers and directives that access the file system. If unset, the default site root is the current working directory.
|
||||
|
||||
Specifically, this directive sets the `{http.vars.root}` placeholder.
|
||||
|
||||
|
||||
## Syntax
|
||||
|
||||
```
|
||||
root [<matcher>] <path>
|
||||
```
|
||||
|
||||
- **<path>** is the path to use for the site root.
|
||||
|
||||
Note that a matcher token is usually required since the first argument is a path, which could look like a path matcher.
|
||||
|
||||
## Examples
|
||||
|
||||
Set the site root to `/home/user/public_html` for all requests:
|
||||
|
||||
```
|
||||
root * /home/user/public_html
|
||||
```
|
||||
|
||||
(A [wildcard matcher](/docs/caddyfile/concepts#wildcard-matcher) is required in this case because the first argument is ambiguous with a [path matcher](/docs/caddyfile/concepts#path-matcher).)
|
||||
|
||||
Set the site root to `public_html` (relative to current working directory) for all requests:
|
||||
|
||||
```
|
||||
root public_html
|
||||
```
|
||||
|
||||
(No matcher token is required here because our site root is a relative path, so it does not start with a forward slash and thus is not ambiguous.)
|
||||
|
||||
Set the site root only for requests in `/foo`:
|
||||
|
||||
```
|
||||
root /foo/* /home/user/public_html/foo
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue