# 静的ファイルの提供

**URL:** <https://meta.discourse.org/t/serve-static-file/80585>\
**Category:** Sysadmins\
**Tags:** how-to\
**Created:** [2018 年 2 月 15 日午前 1:03 UTC](https://meta.discourse.org/t/serve-static-file/80585 "2018-02-15T01:03:40Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2018 年 2 月 15 日午前 1:03 UTC](https://meta.discourse.org/t/serve-static-file/80585/1 "2018-02-15T01:03:40Z")

</div>

Discourse サーバーのルートに静的ファイルを配信したいですか？

以下の手順で行います。`app.yml` ファイルの最下部にあるカスタムコマンドセクションで、以下のように記述してください。

```plaintext
## 覚えておいてください、これは YAML 構文です。同じ名前のブロックは一つしか持てません
run:
  - exec: echo "カスタムコマンドの開始"
  - file:
     path: /var/www/discourse/public/myfile.txt
     chmod: "+r"
     contents: |
       ファイルに含まれる内容がここに書かれます。
  - exec: echo "カスタムコマンドの終了"

```

その後、`. /launcher rebuild app` を実行してください。

これで、ファイルは [http://yourserver.com/myfile.txt](http://yourserver.com/myfile.txt) からアクセス可能になります。

---

_[View the full topic](https://meta.discourse.org/t/serve-static-file/80585)._
