src/includes/quick-assist/content.md
caddyservices.caddyIn Termux: <pre><code class="cmd">pkg install caddy</code></pre>
</div> <div id="qa-content-install_other"> <h4>Webi</h2> <p>Linux and macOS:</p> <pre><code class="cmd bash">curl -sS https://webi.sh/caddy | sh</code></pre> <p>Windows:</p> <pre><code class="cmd">curl.exe https://webi.ms/caddy | powershell</code></pre> <h4>Ansible</h4> <pre><code class="cmd bash">ansible-galaxy install nvjacobo.caddy</code></pre> </div> <div id="qa-content-install_docker"> <pre><code class="cmd bash">docker pull caddy</code></pre> </div> <div id="qa-content-install_build">Make sure to have git and the latest version of Go installed.
xcaddy is a command line tool that helps you build Caddy with plugins. A basic build looks like:
To build with plugins, use --with:
go or xcaddy)Place the binary in one of your $PATH (or %PATH% on Windows) directories so you can run caddy without typing the full path of the executable file. (Run echo $PATH to see the list of directories that qualify.)
You can upgrade static binaries by replacing them with newer versions and restarting Caddy. The caddy upgrade command can make this easy.
On-demand TLS is designed for situations when you either don't control the domain names, or you have too many certificates to load all at once when the server starts. For every other use case, standard TLS automation is likely better suited.
</div> <div id="qa-content-cfg_ondemand_caddyfile">In order to prevent abuse, you must first configure an ask endpoint so Caddy can check whether it should get a certificate. Add this to your global options at the top:
{
on_demand_tls {
ask http://localhost:5555/check
}
}
Change that endpoint to be something you've set up that will respond with HTTP 200 if the domain given in the domain= query parameter is allowed to have a certificate.
Then create a site block that serves all sites/hosts on the TLS port:
https:// {
tls {
on_demand
}
}
This is the minimum config to enable Caddy to accept and service TLS connections for arbitrary hosts. This config doesn't invoke any handlers. Usually you'll also reverse_proxy to your backend application.