# Using Caddy as reverse proxy for Ghost

**URL:** <https://forum.ghost.org/t/using-caddy-as-reverse-proxy-for-ghost/46885>\
**Category:** Share & showcase\
**Created:** [April 26, 2024, 2:00pm UTC](https://forum.ghost.org/t/using-caddy-as-reverse-proxy-for-ghost/46885 "2024-04-26T14:00:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielrosehill](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/danielrosehill/32/15424_2.png) [@danielrosehill](https://forum.ghost.org/u/danielrosehill)\
**Post date:** [April 26, 2024, 2:00pm UTC](https://forum.ghost.org/t/using-caddy-as-reverse-proxy-for-ghost/46885/1 "2024-04-26T14:00:19Z")

</div>

Thought I would try something a little different after migrating to a new server and decided to use Caddy rather than Nginx as the reverse proxy and skipped over the offer to set up Nginx in the Ghost CLI setup.

Took a few attempts to get the Caddyfile correct (the Caddyfile hosts the config for everything), but this is what worked in the end:

```auto
  GNU nano 7.2 Caddyfile                                 
mytechblog.com {
        root * /var/www/mytechblog
        file_server

        reverse_proxy localhost:2368
}

www.mytechblog.com {
        root * /var/www/mytechblog
        file_server

        reverse_proxy localhost:2368
}

```

Points:

→ `www` and `/` are different paths hence the rule has to be configured for both endpoitns  
 → replace `var/www/mytechblog` with the root of your Ghost installation (!)  
 → Caddy automatically provisions the self-signed certs needed for this to work on HTTPS  
 → Config worked out of the box for me behdind Cloudflare

---

<div class="post-metadata">

**Author:** ![jochumdev](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jochumdev/32/30242_2.png) [@jochumdev](https://forum.ghost.org/u/jochumdev)\
**Post date:** [May 5, 2024, 6:30pm UTC](https://forum.ghost.org/t/using-caddy-as-reverse-proxy-for-ghost/46885/2 "2024-05-05T18:30:13Z")

</div>

I think using caddy as file\_server here is a big security issue here.

This allows [mytechblog.com/config.production.json](http://mytechblog.com/config.production.json) to be served, right?

---

<div class="post-metadata">

**Author:** ![TimRyan573](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/timryan573/32/30602_2.png) [@TimRyan573](https://forum.ghost.org/u/TimRyan573)\
**Post date:** [May 27, 2024, 9:21pm UTC](https://forum.ghost.org/t/using-caddy-as-reverse-proxy-for-ghost/46885/3 "2024-05-27T21:21:26Z")

</div>

Is Caddy being used in place of Nginx or on a separate server acting as a reverse proxy for a number of separate network hosts?

I have a 1G Fiber service with a static IP address and a firewall router managing a LAN network with VM’s on a ProxMox PVE8.2.2 cluster and a DNS server that allows many A records to be hosted. Caddy 2.7.6 manages the routing to each host by A record.

Are you using Caddy on the Ghost server itself?
