diff --git a/src/docs/markdown/build.md b/src/docs/markdown/build.md new file mode 100644 index 0000000..b0f4b10 --- /dev/null +++ b/src/docs/markdown/build.md @@ -0,0 +1,66 @@ +--- +title: "Build from source" +--- + +# Build from source + +Requirements: + +- [Go](https://golang.org/dl) 1.14 or newer + +Clone the repository: + +
git clone "https://github.com/caddyserver/caddy.git"
+
+If you don't have git, you can download the source code as a file archive [from GitHub](https://github.com/caddyserver/caddy). Each [release](https://github.com/caddyserver/caddy/releases) also has source snapshots.
+
+Build:
+
+cd caddy/cmd/caddy/
+go build
+
+
+
+## xcaddy
+
+The [`xcaddy` command](https://github.com/caddyserver/xcaddy) is the easiest way to build Caddy with version information and/or plugins.
+
+Requirements:
+
+- Go installed (see above)
+- Make sure [xcaddy](https://github.com/caddyserver/xcaddy/releases) is in your PATH
+
+You do **not** need to download the Caddy source code (it will do that for you).
+
+Then building Caddy (with version information) is as easy as:
+
+xcaddy build
+
+To build with plugins, use `--with`:
+
+xcaddy build \
+ --with github.com/caddyserver/nginx-adapter
+ --with github.com/caddyserver/ntlm-transport@v0.1.1
+
+As you can see, you can customize the versions of plugins with `@` syntax. Versions can be a tag name or commit SHA.
+
+Cross-platform compilation with `xcaddy` works the same as with the `go` command (see below).
+
+
+## Cross-platform
+
+Go programs are easy to compile for other platforms. Just set the `GOOS`, `GOARCH`, and/or `GOARM` environment variables that are different. ([See the go documentation for details.](https://golang.org/doc/install/source#environment))
+
+For example, to compile Caddy for Windows when you're not on Windows:
+
+GOOS=windows go build
+
+Or similarly for Linux ARMv6 when you're not on Linux or on ARMv6:
+
+GOOS=linux GOARCH=arm GOARM=6 go build
+
+The same works for `xcaddy`. To cross-compile for macOS:
+
+GOOS=darwin xcaddy build
diff --git a/src/docs/markdown/caddyfile/directives/header.md b/src/docs/markdown/caddyfile/directives/header.md
index 6020dae..feac2e5 100644
--- a/src/docs/markdown/caddyfile/directives/header.md
+++ b/src/docs/markdown/caddyfile/directives/header.md
@@ -65,4 +65,13 @@ header {
# keep referrer data off of HTTP connections
Referrer-Policy no-referrer-when-downgrade
}
-```
\ No newline at end of file
+```
+
+Multiple header directives that are intended to be mutually-exclusive:
+
+```
+route {
+ header Cache-Control max=age=3600
+ header /static/* Cache-Control max=age=31536000
+}
+```
diff --git a/src/docs/markdown/download.md b/src/docs/markdown/download.md
new file mode 100644
index 0000000..cf1cfe6
--- /dev/null
+++ b/src/docs/markdown/download.md
@@ -0,0 +1,60 @@
+---
+title: "Download Caddy"
+---
+
+# Download Caddy
+
+All our [official distributions](https://github.com/caddyserver/dist) come with only the standard modules. If you need third-party plugins, [build from source with xcaddy](/docs/build#xcaddy).
+
+
+
+## Static binaries
+
+You can **[download Caddy from GitHub](https://github.com/caddyserver/caddy/releases)**, where new releases are immediately published.
+
+Using `curl`:
+
+curl -OL "https://github.com/caddyserver/caddy/releases/latest/download/ASSET"
+
+Using `wget`:
+
+wget "https://github.com/caddyserver/caddy/releases/latest/download/ASSET"
+
+
+## Docker
+
+docker pull caddy
+
+[**View on Docker Hub**](https://hub.docker.com/_/caddy)
+
+
+## Debian, Ubuntu, Raspbian
+
+echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \
+ | sudo tee -a /etc/apt/sources.list.d/caddy-fury.list
+sudo apt update
+sudo apt install caddy
+
+Installing this package automatically starts and runs Caddy for you.
+
+
+## Fedora, RedHat, CentOS
+
+Fedora or RHEL/CentOS 8:
+
+dnf install 'dnf-command(copr)'
+dnf copr enable @caddy/caddy
+dnf install caddy
+
+RHEL/CentOS 7:
+
+yum install yum-plugin-copr
+yum copr enable @caddy/caddy
+yum install caddy
+
+[**View the Caddy COPR**](https://copr.fedorainfracloud.org/coprs/g/caddy/caddy/)
+
+
+## DigitalOcean
+
+[**Deploy a Caddy droplet on DigitalOcean**](https://marketplace.digitalocean.com/apps/caddy)
\ No newline at end of file
diff --git a/src/docs/markdown/getting-started.md b/src/docs/markdown/getting-started.md
index 5d562db..565c571 100644
--- a/src/docs/markdown/getting-started.md
+++ b/src/docs/markdown/getting-started.md
@@ -26,6 +26,8 @@ Welcome to Caddy! This tutorial will explore the basics of using Caddy and help
---
+**If you [installed Caddy](/docs/download) from a package manager, Caddy might already be running as a service. If so, please stop the service before doing this tutorial.**
+
Let's start by running it:
caddy
@@ -166,16 +168,16 @@ The Caddyfile seems easier than JSON, but should you always use it? There are pr
JSON | Caddyfile
-----|----------
-Ubiquitous | Niche
+Full range of Caddy functionality | Most common parts of Caddy functionality
Easy to generate | Easy to craft by hand
Easily programmable | Difficult to automate
-Full range of Caddy functionality | Most common parts of Caddy functionality
Extremely expressive | Moderately expressive
Allows config traversal | Cannot traverse within Caddyfile
Partial config changes | Whole config changes only
Can be exported | Cannot be exported
Compatible with all API endpoints | Compatible with some API endpoints
Documentation generated automatically | Documentation is hand-written
+Ubiquitous | Niche
More efficient | More computational
Kind of boring | Kind of fun
**Learn more: [JSON structure](/docs/json/)** | **Learn more: [Caddyfile docs](/docs/caddyfile)**
diff --git a/src/docs/markdown/install.md b/src/docs/markdown/install.md
index 76101e3..771def8 100644
--- a/src/docs/markdown/install.md
+++ b/src/docs/markdown/install.md
@@ -4,46 +4,18 @@ title: "Install"
# Install
-Caddy is available for every platform as a [static binary](https://github.com/caddyserver/caddy/releases) (it has no dependencies). You can also [build from source](#build-from-source) to customize your build.
-
-
-## Official packages
-
-We maintain [official distributions](https://github.com/caddyserver/dist) for the following platforms:
-
-### Docker
-
-docker pull caddy
-
-[**View on Docker Hub**](https://hub.docker.com/_/caddy)
-
-
-### Debian, Ubuntu, Raspbian
-
-echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \
- | sudo tee -a /etc/apt/sources.list.d/caddy-fury.list
-sudo apt update
-sudo apt install caddy
-
-
-### Fedora, RedHat, CentOS
-
-Read how to [**install the Caddy COPR**](https://copr.fedorainfracloud.org/coprs/g/caddy/caddy/).
-
-
-### DigitalOcean
-
-[**Create a Caddy droplet**](https://marketplace.digitalocean.com/apps/caddy) and get started in 90 seconds.
+This page describes how to manually install Caddy as a service.
+
## Linux service
-This section describes how to manually install Caddy as a Linux service.
-
Requirements:
-- `caddy` binary that you downloaded or built from source
+- `caddy` binary that you [downloaded](/docs/download) or [built from source](/docs/build)
- `systemctl --version` 232 or newer
- `sudo` privileges
@@ -100,27 +72,4 @@ You can stop the service with:
Do not stop the service to change Caddy's configuration. Stopping the server will incur downtime. Use the reload command instead.
-## Build from source
-
-Requirements:
-
-- [Go](https://golang.org/dl) 1.14 or newer
-- [Go modules](https://github.com/golang/go/wiki/Modules) enabled
-
-Download the source code:
-
-git clone "https://github.com/caddyserver/caddy.git"
-
-Build:
-
-cd caddy/cmd/caddy/
-go build
-
-
-### With plugins
-
-Using [xcaddy](https://github.com/caddyserver/xcaddy), you can compile Caddy with extra plugins, for example:
-
-xcaddy build \
- --with github.com/caddyserver/nginx-adapter
- --with github.com/caddyserver/ntlm-transport@v0.1.0
\ No newline at end of file
+Now that Caddy is installed, see our [Getting Started](/docs/getting-started) tutorial to learn how to use it!
\ No newline at end of file
diff --git a/src/includes/docs-nav.html b/src/includes/docs-nav.html
index 9d006b3..6dfbfbc 100644
--- a/src/includes/docs-nav.html
+++ b/src/includes/docs-nav.html
@@ -1,8 +1,12 @@