# Use Caddy instead of NGINX as your reverse proxy

**URL:** https://meta.discourse.org/t/use-caddy-instead-of-nginx-as-your-reverse-proxy/54716
**Category:** Self-Hosting
**Tags:** how-to
**Created:** [December 23, 2016, 4:35pm UTC](https://meta.discourse.org/t/use-caddy-instead-of-nginx-as-your-reverse-proxy/54716 "2016-12-23T16:35:50Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [December 23, 2016, 4:35pm UTC](https://meta.discourse.org/t/use-caddy-instead-of-nginx-as-your-reverse-proxy/54716/1 "2016-12-23T16:35:50Z")

</div>

![](https://global.discourse-cdn.com/meta/original/3X/2/9/29084cf4e1415d32ef08723b318e3030d719c9cb.png)

Here are some notes about how I got my test Discourse instance running with [Caddy Server](https://caddyserver.com/).

Cool stuff about Caddy:

- They [use Discourse](https://caddy.community/) 😄

- [Free SSL](https://caddyserver.com/docs/automatic-https) with Let’s Encrypt

- HTTP2 and [QUIC](https://www.chromium.org/quic) out of the box

- Easier to configure than nginx

Cons:

- Not as battle tested as apache, nginx and cia.

## How To

### Preparing Discourse

First, you need to apply this changes to your `app.yml`:

```bash
templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
  - "templates/web.socketed.template.yml" # <<<----- THIS IS NEW

## Leave these two commented out
# - "templates/web.ssl.template.yml"
# - "templates/web.letsencrypt.ssl.template.yml"

## Leave these two commented out 
expose:
# - "8080:80" # http
# - "443:443" # https

env:
  ## This should be commented out
  #LETSENCRYPT_ACCOUNT_EMAIL: mymail@gmail.com
  ## This is required to avoid mixed content warnings when behind a reverse proxy
  DISCOURSE_FORCE_HTTPS: true

```

### Preparing Caddy

In the spirit of Discourse, let’s put Caddy in a Docker image too 🐳

First prepare with:

```plaintext
mkdir -p /var/caddy/data /var/caddy/config
nano /var/caddy/Caddyfile

```

Add the following to the Caddyfile (using Caddy v2 syntax):

```bash
{
  email MYEMAILHERE@gmail.com
}

forum.example.com { # your domain here
  reverse_proxy unix//sock/nginx.http.sock
}

```

Save and exit.

### Let’s test

Now you need to rebuild Discourse:

```bash
cd /var/discourse
./launcher rebuild app

```

And then run Caddy:

```bash
docker run -d \
    -v /var/caddy/Caddyfile:/etc/caddy/Caddyfile \
    -v /var/caddy/data:/data \
    -v /var/caddy/config:/config \
    -v /var/discourse/shared/standalone:/sock \
    -p 80:80 -p 443:443 \
    -p 443:443/udp \
    --restart=always \
    --name caddy \
    caddy:latest

```

After all, your forum should be avaliable at your domain, using SSL + HTTP2 + QUIC. You can’t more hipster than that.

> Last edited by @pacharanero 2026-04-19T13:38:22Z
> 
> > **Check document**
> >
> > Perform check on document:

---

_[View the full topic](https://meta.discourse.org/t/use-caddy-instead-of-nginx-as-your-reverse-proxy/54716)._
