「Caddy」の版間の差分
Kusanaginoturugi (トーク | 投稿記録) (→インストール: == Plugins == を追加) |
Kusanaginoturugi (トーク | 投稿記録) (→使用方法: == Troubleshooting == を追加) |
||
40行目: | 40行目: | ||
$ caddy -conf="../path/to/Caddyfile" |
$ caddy -conf="../path/to/Caddyfile" |
||
+ | |||
+ | == Troubleshooting == |
||
+ | |||
+ | === Certificate error === |
||
+ | |||
+ | If you are facing any issues related to SSL certificates (especially on non-public domains), it is probably because the running caddy instance does not have permission to add the certificate to the system's trust store. This seems to be the case when the systemd unit (caddy.service) is used to autostart caddy. |
||
+ | |||
+ | To fix this, run the following as root. You only have to run this once in a very long time (lifetime of the root certificate). |
||
+ | |||
+ | # XDG_DATA_HOME=/var/lib caddy trust |
||
== 参照 == |
== 参照 == |
2021年12月9日 (木) 14:02時点における最新版
Caddy は自動的に HTTPS を使用する HTTP/2 対応のウェブサーバーです。
インストール
Plugins
If you need more than the base version of caddy, you can use xcaddy-binAUR to customize your caddy server build. This is useful if you need the additional plugins for DNS challenge etc. Alternatively, if a pre-built package, with the plugins you require, is already available you may choose to install those from AUR, for eg. caddy-cloudflareAUR
For a custom caddy server build you can use xcaddy to build caddy with the necessary plugin modules:
$ xcaddy build [<caddy_version>] [--output <file>] [--with <module[@version][=replacement]>...]
For more information, see the xcaddy repository.
設定
Caddy は Caddyfile
という名前のプレーンテキストファイルを使って設定します。Caddyfile
にはまずサイトのアドレスを記述して、それからディレクティブをいくつか書きます。
gzip 圧縮を使用し ../access.log
にログを出力して localhost:2020
からアクセスできるサイトを記述した Caddyfile
の例:
localhost:2020 gzip log ../access.log
使用方法
Caddy はページがあるディレクトリから通常ユーザーで実行できます。同一ディレクトリに Caddyfile
が存在する必要があります:
$ caddy
もしくは Caddyfile
を指定して実行することもできます:
$ caddy -conf="../path/to/Caddyfile"
Troubleshooting
Certificate error
If you are facing any issues related to SSL certificates (especially on non-public domains), it is probably because the running caddy instance does not have permission to add the certificate to the system's trust store. This seems to be the case when the systemd unit (caddy.service) is used to autostart caddy.
To fix this, run the following as root. You only have to run this once in a very long time (lifetime of the root certificate).
# XDG_DATA_HOME=/var/lib caddy trust