# 为 Discourse 重建或启动时添加一个离线页面显示

**URL:** <https://meta.discourse.org/t/add-an-offline-page-to-display-when-discourse-is-rebuilding-or-starting-up/45238>\
**Category:** Sysadmins\
**Tags:** configuring, how-to, advanced-setup\
**Created:** [2016年六月4日 08:41 UTC](https://meta.discourse.org/t/add-an-offline-page-to-display-when-discourse-is-rebuilding-or-starting-up/45238 "2016-06-04T08:41:48Z")\
**Posts on this page:** 1\
**Showing post:** 157

<div class="post-metadata">

**Author:** ![Sailor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sailor/32/579029_2.png) [@Sailor](https://meta.discourse.org/u/Sailor)\
**Post date:** [2025年三月5日 17:53 UTC](https://meta.discourse.org/t/add-an-offline-page-to-display-when-discourse-is-rebuilding-or-starting-up/45238/157 "2025-03-05T17:53:41Z")

</div>

此线程中的想法对于我们这些使用 [caddy 作为反向代理](https://meta.discourse.org/t/use-caddy-instead-of-ngnix-as-your-reverse-proxy/54716?u=sailor) 的人来说也很棒，无论是作为独立应用程序还是使用 [Cloudflare Tunnels](https://meta.discourse.org/t/install-discourse-on-a-residential-internet-with-cloudflare-tunnel/211297?u=sailor)。

```plaintext
discourse.example.org {
        reverse_proxy <host | ip>:port

        handle_errors 5xx {
                root * /path/to/error-pages
                rewrite * /error.html
                file_server {
                        status 404
                }
        }
}

```

仅在使用 Cloudflare Tunnels 时 `status 404` 部分才重要。如果 caddy 向 Cloudflare 返回 5xx，Cloudflare Tunnel 将显示其自己的断开连接错误。更改状态表示 Cloudflare 存在一个有效的实时连接，该连接将提供错误页面。

---

_[View the full topic](https://meta.discourse.org/t/add-an-offline-page-to-display-when-discourse-is-rebuilding-or-starting-up/45238)._
