Putting caddy in /usr/local/bin (may require password)
Caddy 0.9.1 (+e8e5595)
Successfully installed
This is different from the Download page, where you get to select additional features (see the &features= URL query parameter).
1
2
$ which caddy
caddy is /usr/local/bin/caddy
Get the installed version:
1
2
$ caddy --version
Caddy 0.9.1 (+e8e5595)
Get help:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$ caddy -h
Usage of caddy:
-agree
Agree to the CA's Subscriber Agreement
-ca string
URL to certificate authority's ACME server directory (default"https://acme-v01.api.letsencrypt.org/directory")
-conf string
Caddyfile to load (default"Caddyfile")
-cpu string
CPU cap (default"100%")
-email string
Default ACME CA account email address
-grace duration
Maximum duration of graceful shutdown (default5s)
-host string
Default host
-http2
Use HTTP/2 (default true)
-log string
Process log file
-pidfile string
Path to write pid file
-plugins
List installed plugins
-portstring
Defaultport (default"2015")
-quic
Use experimental QUIC
-quiet
Quiet mode (no initialization output)
-revoke string
Hostname for which to revoke the certificate
-root string
Root path ofdefault site (default".")
-typestring
Typeof server to run (default"http")
-version
Show version
Run Caddy locally:
1
2
3
4
$ caddy
Activating privacy features... done.
http://:2015
WARNING: File descriptor limit 1024 is too low for production servers. At least 8192 is recommended. Fix with "ulimit -n 8192".
A file descriptor is simply a number that the operating system assigns to an open file to keep track of it. Caddy’s primary goal is to be an easy-to-use static file web server. Having high file descriptor limit means it can open more files to serve users at the same time.
1
2
3
$ ulimit -Sn && ulimit -Hn
1024
4096
The current system is too low in both soft and hard limits. But since it’s not in production, warning can be ignored.
Make sure the server working:
1
2
3
4
5
6
7
8
$ http :2015
HTTP/1.1404Not Found
Content-Length: 14
Content-Type: text/plain; charset=utf-8
Server: Caddy
X-Content-Type-Options: nosniff
404Not Found
Response header X-Content-Type-Options: nosniff prevents MIME based attacks, it tells the browser to respect the response content type, not to override.
Status code 404 means working, but just lacks an index file. Let’s create one: