> ## Documentation Index
> Fetch the complete documentation index at: https://www.jetify.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Caddy

> Caddy can be configured automatically using Devbox's built in Caddy plugin. This plugin will activate automatically when you install Caddy using `devbox add caddy`.

[**Example Repo**](https://github.com/jetify-com/devbox/tree/main/examples/servers/caddy)

### Adding Caddy to your Shell[​](#adding-caddy-to-your-shell "Direct link to Adding Caddy to your Shell")

Run `devbox add caddy`, or add the following to your `devbox.json`

```json theme={null}
  "packages": [
    "caddy@latest"
  ]
```

This will install the latest version of Caddy. You can find other installable versions of Caddy by
running `devbox search caddy`. You can also view the available versions on
[Nixhub](https://www.nixhub.io/packages/caddy)

## Caddy Plugin Details[​](#caddy-plugin-details "Direct link to Caddy Plugin Details")

The Caddy plugin will automatically create the following configuration when you install Caddy with
`devbox add`

### Services[​](#services "Direct link to Services")

* caddy

Use `devbox services start|stop caddy` to start and stop httpd in the background

### Helper Files[​](#helper-files "Direct link to Helper Files")

The following helper files will be created in your project directory:

* \{PROJECT\_DIR}/devbox.d/caddy/Caddyfile
* \{PROJECT\_DIR}/devbox.d/web/index.html

Note that by default, Caddy is configured with `./devbox.d/web` as the root. To change this, you
should modify the default `./devbox.d/caddy/Caddyfile` or change the `CADDY_ROOT_DIR` environment
variable

### Environment Variables[​](#environment-variables "Direct link to Environment Variables")

```
* CADDY_CONFIG={PROJECT_DIR}/devbox.d/caddy/Caddyfile
* CADDY_LOG_DIR={PROJECT_DIR}/.devbox/virtenv/caddy/log
* CADDY_ROOT_DIR={PROJECT_DIR}/devbox.d/web
```

### Notes[​](#notes "Direct link to Notes")

You can customize the config used by the caddy service by modifying the Caddyfile in devbox.d/caddy,
or by changing the CADDY\_CONFIG environment variable to point to a custom config. The custom config
must be either JSON or Caddyfile format.

### Disabling the Caddy Plugin[​](#disabling-the-caddy-plugin "Direct link to Disabling the Caddy Plugin")

You can disable the Caddy plugin by running `devbox add caddy --disable-plugin`, or by setting the
`disable_plugin` field in your `devbox.json`:

```json theme={null}
{
  "packages": {
    "caddy": {
      "version": "latest",
      "disable_plugin": true
    }
  }
}
```

[Edit this page](https://github.com/jetify-com/docs/tree/main/docs/devbox/devbox-examples/servers/caddy/index.mdx)
