mirror of
https://github.com/caddyserver/website.git
synced 2025-04-24 14:06:17 -04:00
docs: All-new design, along with many content updates in prep for RC1
This commit is contained in:
parent
fe58da0269
commit
3ecf039665
23 changed files with 562 additions and 435 deletions
|
@ -6,6 +6,10 @@ title: HTTPS quick-start
|
|||
|
||||
This guide will show you how to get up and running with [fully-managed HTTPS](/docs/automatic-https) in no time.
|
||||
|
||||
<aside class="tip">
|
||||
Caddy uses HTTPS for all sites by default, as long as a host name is provided in the config. This tutorial assumes you want to get a publicly-trusted site up over HTTPS, which requires a public domain name (i.e. not "localhost") and external ports.
|
||||
</aside>
|
||||
|
||||
**Prerequisites:**
|
||||
- Basic terminal / command line skills
|
||||
- Basic understanding of DNS
|
||||
|
@ -24,15 +28,15 @@ Before continuing, verify correct records with an authoritative lookup. Replace
|
|||
<pre><code class="cmd bash">curl "https://cloudflare-dns.com/dns-query?name=example.com&type=A" \
|
||||
-H "accept: application/dns-json"</code></pre>
|
||||
|
||||
<aside class="tip">If you're on your home network or some other restricted intranet, you may need to forward ports or adjust firewall settings.</aside>
|
||||
|
||||
Also make sure your server is externally reachable on ports 80 and 443 from a public interface.
|
||||
|
||||
<aside class="tip">If you're on your home or other restricted network, you may need to forward ports or adjust firewall settings.</aside>
|
||||
|
||||
All we have to do is start Caddy with your domain name in the config. There are several ways to do this.
|
||||
|
||||
## Caddyfile
|
||||
|
||||
This is the most common way to get HTTPS; it works for almost any kind of site.
|
||||
This is the most common way to get HTTPS.
|
||||
|
||||
Create a file called `Caddyfile` (no extension) where the first line is your domain name, for example:
|
||||
|
||||
|
@ -46,12 +50,12 @@ Then from the same directory, run:
|
|||
|
||||
<pre><code class="cmd bash">caddy run</code></pre>
|
||||
|
||||
You will see Caddy provision a TLS certificate and serve your site over HTTPS.
|
||||
You will see Caddy provision a TLS certificate and serve your site over HTTPS. This was possible because your site's address in the Caddyfile contained a domain name.
|
||||
|
||||
|
||||
## The `file-server` command
|
||||
|
||||
If all you need is a file server over HTTPS, run this command (replacing your domain name):
|
||||
If all you need is serving static files over HTTPS, run this command (replacing your domain name):
|
||||
|
||||
<pre><code class="cmd bash">caddy file-server --domain example.com</code></pre>
|
||||
|
||||
|
@ -69,7 +73,7 @@ You will see Caddy provision a TLS certificate and serve your site over HTTPS.
|
|||
|
||||
## JSON config
|
||||
|
||||
The general rule of thumb is that any [host matcher](/docs/json/apps/http/servers/routes/match/host/) with a host that looks like a domain name will trigger automatic HTTPS.
|
||||
The general rule of thumb is that any [host matcher](/docs/json/apps/http/servers/routes/match/host/) will trigger automatic HTTPS.
|
||||
|
||||
Thus, a JSON config such as the following will enable production-ready [automatic HTTPS](/docs/automatic-https):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue