mirror of
https://github.com/caddyserver/website.git
synced 2025-04-24 22:16:15 -04:00
Updated for v2.8.0
This commit is contained in:
parent
1a82466537
commit
eb033e57b5
19 changed files with 223 additions and 69 deletions
48
src/docs/markdown/caddyfile/directives/fs.md
Normal file
48
src/docs/markdown/caddyfile/directives/fs.md
Normal file
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
title: fs (Caddyfile directive)
|
||||
---
|
||||
|
||||
# fs
|
||||
|
||||
Sets which file system should be used for performing file I/O.
|
||||
|
||||
This could let you connect to a remote filesystem running in the cloud, or a database with a file-like interface, or even to read from files embedded within the Caddy binary.
|
||||
|
||||
First, you must declare a file system name using the [`filesystem` global option](/docs/caddyfile/options#filesystem), then you can use this directive to specify which file system to use.
|
||||
|
||||
This directive is often used in conjunction with the [`file_server` directive](file_server) to serve static files, or the [`try_files` directive](try_files) to perform rewrites based on the existence of files. Typically also used with [`root` directive](root) to set the root path within the file system.
|
||||
|
||||
|
||||
## Syntax
|
||||
|
||||
```caddy-d
|
||||
fs [<matcher>] <filesystem>
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
Using an file system named `foo`, using an imaginary module named `custom` which might require authentication:
|
||||
|
||||
```caddy
|
||||
{
|
||||
filesystem foo custom {
|
||||
api_key abc123
|
||||
}
|
||||
}
|
||||
|
||||
example.com {
|
||||
fs foo
|
||||
root /srv
|
||||
file_server
|
||||
}
|
||||
```
|
||||
|
||||
To only serve images from the `foo` file system, and the rest from the default file system:
|
||||
|
||||
```caddy
|
||||
example.com {
|
||||
fs /images* foo
|
||||
root /srv
|
||||
file_server
|
||||
}
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue