Always served an empty file

I’m very new to this and have done my best to provide the correct details. Please be gentle.

1. Caddy version (caddy version):

2.2.1

2. How I run Caddy:

  • Created a DigitalOcean Droplet with Caddy on Ubuntu 18.04.
  • Pointed the A records for my domain (tryfigures.com) to the IPv4 address assigned by DigitalOcean.
  • Uploaded a single html file (index.html) and its supporting css files to /var/www/html
  • Modified the Caddyfile as directed (contents listed below)
  • Waited 30 min to be sure DNS was pointing to the right place
  • Entered the domain into a web browser

a. System environment:

DigitalOcean Droplet running Ubuntu 18.04
Caddy v2.2.1

b. Command:

I didn’t start Caddy with a command.
I presume the DigitalOcean Droplet does this via a script, but I don’t see where I would find that command.

c. Service/unit/compose file:

I’ve looked for a file with this description, but no luck. I’m just not sure what this means. Sorry :frowning:

d. My complete Caddyfile or JSON config:

# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace the line below with your
# domain name.
tryfigures.com

# Set this path to your site's directory.
root * /var/www/html

# Enable the static file server.
file_server

# Another common task is to set up a reverse proxy:
# reverse_proxy localhost:8080

# Or serve a PHP site through php-fpm:
# php_fastcgi localhost:9000

# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile

3. The problem I’m having:

Typed curl -v tryfigures.com/index.html and received:

*   Trying 142.93.51.30:80...
* Connected to tryfigures.com (142.93.51.30) port 80 (#0)
> GET /index.html HTTP/1.1
> Host: tryfigures.com
> User-Agent: curl/7.77.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 308 Permanent Redirect
< Connection: close
< Location: https://tryfigures.com/index.html
< Server: Caddy
< Date: Sun, 13 Feb 2022 17:11:41 GMT
< Content-Length: 0
< 
* Closing connection 0

Any path on my domain, even an invalid one, returns an empty document.
I know the directions say not to use web browsers, but I tried that as well without success.

4. Error messages and/or full log output:

No error messages received

5. What I already tried:

  • I tried curl with just the domain name, with a path to a known file, and to an invalid path. All returned an empty document
  • I’ve pored through the documentation and forums looking for any missing settings or files, but I can’t find anything relevant.

6. Links to relevant resources:

  • Found this post where the issue was a trailing / in the domain. Verified the Caddyfile doesn’t use a trailing slash.
  • In this post, the issue was using localhost. Not my issue.
  • In an issue on Github, someone had the same issue, but hadn’t included the file_server entry in the Caddyfile which I have.

I’m sure there are terms I’ve misunderstood or steps that I should have taken but didn’t. I would greatly appreciate any guidance to get a new but enthusiastic user on the right path. :slight_smile:

That’s quite an old version. Please upgrade to the latest, v2.4.6. You probably just need to update your apt packages to do so.

That’s Caddy serving a HTTP->HTTPS redirect.

See the Location header, that’s an instruction to the client to retry the request at a different URL.

Try curl -v https://tryfigures.com/index.html instead, i.e. specify https:// to make sure you directly request the right file, or use the -L option of curl to follow redirects (-L for Location).

Follow the instructions found here to see your logs:

Thanks so much for the help.

I was able to update Caddy to v2.4.6.
Then I tried the curl command as you suggested and I got:

*   Trying 142.93.51.30:443...
* connect to 142.93.51.30 port 443 failed: Connection refused
* Failed to connect to tryfigures.com port 443: Connection refused
* Closing connection 0
curl: (7) Failed to connect to tryfigures.com port 443: Connection refused

I also got the same result when using http (except port 80 instead of 443).
I did some checking around, but didn’t see any relevant advice on this issue.

Here’s the log output:

-- Logs begin at Sun 2022-02-13 15:54:03 UTC, end at Sun 2022-02-13 18:50:48 UTC. --
Feb 13 16:20:49 figures-website systemd[1]: Reloading Caddy.
Feb 13 16:20:49 figures-website caddy[21579]: {"level":"info","ts":1644769249.351797,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.3560305,"logger":"admin.api","msg":"received request","method":"POST","host":"localhost:2019","uri":"/load","remote_addr":"127.0.0.1:55152","headers":{"Accept-Encoding":["gzip"],"Content-Length":["283"],"Content-Type":["application/json"],"Origin":["localhost:2019"],"User-Agent":["Go-http-client/1.1"]}}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.3622882,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.362961,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.363256,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.363815,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["tryfigures.com"]}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.3643358,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc00019c310"}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.3681657,"logger":"tls.obtain","msg":"acquiring lock","identifier":"tryfigures.com"}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.3721168,"logger":"tls.obtain","msg":"lock acquired","identifier":"tryfigures.com"}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.8491871,"logger":"tls.issuance.acme","msg":"waiting on internal rate limiter","identifiers":["tryfigures.com"]}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.8497832,"logger":"tls.issuance.acme","msg":"done waiting on internal rate limiter","identifiers":["tryfigures.com"]}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.864396,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0xc00019ce70"}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.8652277,"msg":"autosaved config","file":"/var/lib/caddy/.config/caddy/autosave.json"}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.8654559,"logger":"admin.api","msg":"load complete"}
Feb 13 16:20:49 figures-website systemd[1]: Reloaded Caddy.
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.99203,"logger":"tls.issuance.acme.acme_client","msg":"trying to solve challenge","identifier":"tryfigures.com","challenge_type":"tls-alpn-01","ca":"https://acme-v02.api.letsencrypt.org/directory"}
Feb 13 16:20:50 figures-website caddy[1104]: {"level":"info","ts":1644769250.189515,"logger":"tls","msg":"served key authentication certificate","server_name":"tryfigures.com","challenge":"tls-alpn-01","remote":"18.116.86.117:62290"}
Feb 13 16:20:50 figures-website caddy[1104]: {"level":"info","ts":1644769250.304307,"logger":"tls","msg":"served key authentication certificate","server_name":"tryfigures.com","challenge":"tls-alpn-01","remote":"66.133.109.36:47456"}
Feb 13 16:20:50 figures-website caddy[1104]: {"level":"info","ts":1644769250.3123791,"logger":"tls","msg":"served key authentication certificate","server_name":"tryfigures.com","challenge":"tls-alpn-01","remote":"34.219.87.132:34516"}
Feb 13 16:20:50 figures-website caddy[1104]: {"level":"info","ts":1644769250.355632,"logger":"tls","msg":"served key authentication certificate","server_name":"tryfigures.com","challenge":"tls-alpn-01","remote":"18.192.36.99:16750"}
Feb 13 16:20:50 figures-website caddy[1104]: {"level":"info","ts":1644769250.364408,"logger":"admin","msg":"stopped previous server"}
Feb 13 16:20:50 figures-website caddy[1104]: {"level":"info","ts":1644769250.673429,"logger":"tls.issuance.acme.acme_client","msg":"validations succeeded; finalizing order","order":"https://acme-v02.api.letsencrypt.org/acme/order/407506630/63641688980"}
Feb 13 16:20:51 figures-website caddy[1104]: {"level":"info","ts":1644769251.1413736,"logger":"tls.issuance.acme.acme_client","msg":"successfully downloaded available certificate chains","count":2,"first_url":"https://acme-v02.api.letsencrypt.org/acme/cert/035a245be5c3abb907c7724a54a410866ef6"}
Feb 13 16:20:51 figures-website caddy[1104]: {"level":"info","ts":1644769251.1425476,"logger":"tls.obtain","msg":"certificate obtained successfully","identifier":"tryfigures.com"}
Feb 13 16:20:51 figures-website caddy[1104]: {"level":"info","ts":1644769251.1427863,"logger":"tls.obtain","msg":"releasing lock","identifier":"tryfigures.com"}
Feb 13 16:34:25 figures-website systemd[1]: Reloading Caddy.
Feb 13 16:34:25 figures-website caddy[21610]: {"level":"info","ts":1644770065.4432976,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Feb 13 16:34:25 figures-website caddy[21610]: reload: adapting config using caddyfile: parsing caddyfile tokens for 'root': /etc/caddy/Caddyfile:13 - Error during parsing: Wrong argument count or unexpected line ending after 'root'
Feb 13 16:34:25 figures-website systemd[1]: caddy.service: Control process exited, code=exited status=1
Feb 13 16:34:25 figures-website systemd[1]: Reload failed for Caddy.
Feb 13 16:34:42 figures-website systemd[1]: Reloading Caddy.
Feb 13 16:34:42 figures-website caddy[21617]: {"level":"info","ts":1644770082.7843702,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Feb 13 16:34:42 figures-website caddy[1104]: {"level":"info","ts":1644770082.7879424,"logger":"admin.api","msg":"received request","method":"POST","host":"localhost:2019","uri":"/load","remote_addr":"127.0.0.1:55160","headers":{"Accept-Encoding":["gzip"],"Content-Length":["283"],"Content-Type":["application/json"],"Origin":["localhost:2019"],"User-Agent":["Go-http-client/1.1"]}}
Feb 13 16:34:42 figures-website caddy[1104]: {"level":"info","ts":1644770082.788797,"logger":"admin.api","msg":"config is unchanged"}
Feb 13 16:34:42 figures-website caddy[1104]: {"level":"info","ts":1644770082.7890775,"logger":"admin.api","msg":"load complete"}
Feb 13 16:34:42 figures-website systemd[1]: Reloaded Caddy.
Feb 13 16:39:03 figures-website caddy[1104]: {"level":"info","ts":1644770343.9256701,"logger":"admin.api","msg":"received request","method":"GET","host":"localhost:2019","uri":"/config/","remote_addr":"127.0.0.1:55162","headers":{"Accept":["*/*"],"User-Agent":["curl/7.58.0"]}}
Feb 13 18:36:04 figures-website caddy[1104]: {"level":"info","ts":1644777364.387978,"logger":"admin.api","msg":"received request","method":"POST","host":"localhost:2019","uri":"/stop","remote_addr":"127.0.0.1:55170","headers":{"Accept-Encoding":["gzip"],"Content-Length":["0"],"Origin":["localhost:2019"],"User-Agent":["Go-http-client/1.1"]}}
Feb 13 18:36:04 figures-website caddy[1104]: {"level":"info","ts":1644777364.3880281,"logger":"admin.api","msg":"unloading"}
Feb 13 18:36:05 figures-website caddy[1104]: {"level":"info","ts":1644777365.3885179,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0xc00019c310"}
Feb 13 18:36:05 figures-website caddy[1104]: {"level":"info","ts":1644777365.3886387,"logger":"admin.api","msg":"unloading completed"}
Feb 13 18:36:05 figures-website caddy[1104]: {"level":"info","ts":1644777365.8891401,"logger":"admin","msg":"stopped previous server"}
Feb 13 18:36:05 figures-website caddy[1104]: {"level":"info","ts":1644777365.8892074,"logger":"admin.api","msg":"stopping now, bye!! 👋"}
Feb 13 18:36:05 figures-website systemd[1]: caddy.service: Failed with result 'exit-code'.
Feb 13 18:38:41 figures-website systemd[1]: Starting Caddy...
Feb 13 18:38:41 figures-website caddy[24678]: caddy.HomeDir=/var/lib/caddy
Feb 13 18:38:41 figures-website caddy[24678]: caddy.AppDataDir=/var/lib/caddy/.local/share/caddy
Feb 13 18:38:41 figures-website caddy[24678]: caddy.AppConfigDir=/var/lib/caddy/.config/caddy
Feb 13 18:38:41 figures-website caddy[24678]: caddy.ConfigAutosavePath=/var/lib/caddy/.config/caddy/autosave.json
Feb 13 18:38:41 figures-website caddy[24678]: caddy.Version=v2.4.6 h1:HGkGICFGvyrodcqOOclHKfvJC0qTU7vny/7FhYp9hNw=
Feb 13 18:38:41 figures-website caddy[24678]: runtime.GOOS=linux
Feb 13 18:38:41 figures-website caddy[24678]: runtime.GOARCH=amd64
Feb 13 18:38:41 figures-website caddy[24678]: runtime.Compiler=gc
Feb 13 18:38:41 figures-website caddy[24678]: runtime.NumCPU=1
Feb 13 18:38:41 figures-website caddy[24678]: runtime.GOMAXPROCS=1
Feb 13 18:38:41 figures-website caddy[24678]: runtime.Version=go1.17.2
Feb 13 18:38:41 figures-website caddy[24678]: os.Getwd=/
Feb 13 18:38:41 figures-website caddy[24678]: LANG=C.UTF-8
Feb 13 18:38:41 figures-website caddy[24678]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
Feb 13 18:38:41 figures-website caddy[24678]: NOTIFY_SOCKET=/run/systemd/notify
Feb 13 18:38:41 figures-website caddy[24678]: HOME=/var/lib/caddy
Feb 13 18:38:41 figures-website caddy[24678]: LOGNAME=caddy
Feb 13 18:38:41 figures-website caddy[24678]: USER=caddy
Feb 13 18:38:41 figures-website caddy[24678]: INVOCATION_ID=f62827b6bde6474fbe7641a856af9dc0
Feb 13 18:38:41 figures-website caddy[24678]: JOURNAL_STREAM=9:139733
Feb 13 18:38:41 figures-website caddy[24678]: {"level":"info","ts":1644777521.9021733,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Feb 13 18:38:41 figures-website systemd[1]: Started Caddy.
Feb 13 18:38:41 figures-website caddy[24678]: run: loading initial config: loading new config: starting caddy administration endpoint: listen tcp 127.0.0.1:2019: bind: address already in use
Feb 13 18:38:42 figures-website systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Feb 13 18:38:42 figures-website systemd[1]: caddy.service: Failed with result 'exit-code'.

Caddy wasn’t able to start because you already had another instance running. Make sure to kill any running Caddy instances before running sudo systemctl start caddy again.

Ok, killed the process and started using systemctl. However, I’m back to the beginning again. Empty document is being served each time.

Here’s the result of the curl command:

*   Trying 142.93.51.30:443...
* Connected to tryfigures.com (142.93.51.30) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-ECDSA-CHACHA20-POLY1305
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=tryfigures.com
*  start date: Feb 13 15:20:50 2022 GMT
*  expire date: May 14 15:20:49 2022 GMT
*  subjectAltName: host "tryfigures.com" matched cert's "tryfigures.com"
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x142812800)
> GET /index.html HTTP/2
> Host: tryfigures.com
> user-agent: curl/7.77.0
> accept: */*
> 
* Connection state changed (MAX_CONCURRENT_STREAMS == 250)!
< HTTP/2 403 
< server: Caddy
< content-length: 0
< date: Sun, 13 Feb 2022 19:28:53 GMT
< 
* Connection #0 to host tryfigures.com left intact

And the current logs:

-- Logs begin at Sun 2022-02-13 15:54:03 UTC, end at Sun 2022-02-13 19:29:47 UTC. --
Feb 13 16:20:49 figures-website systemd[1]: Reloading Caddy.
Feb 13 16:20:49 figures-website caddy[21579]: {"level":"info","ts":1644769249.351797,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.3560305,"logger":"admin.api","msg":"received request","method":"POST","host":"localhost:2019","uri":"/load","remote_addr":"127.0.0.1:55152","headers":{"Accept-Encoding":["gzip"],"Content-Length":["283"],"Content-Type":["application/json"],"Origin":["localhost:2019"],"User-Agent":["Go-http-client/1.1"]}}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.3622882,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.362961,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.363256,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.363815,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["tryfigures.com"]}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.3643358,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc00019c310"}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.3681657,"logger":"tls.obtain","msg":"acquiring lock","identifier":"tryfigures.com"}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.3721168,"logger":"tls.obtain","msg":"lock acquired","identifier":"tryfigures.com"}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.8491871,"logger":"tls.issuance.acme","msg":"waiting on internal rate limiter","identifiers":["tryfigures.com"]}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.8497832,"logger":"tls.issuance.acme","msg":"done waiting on internal rate limiter","identifiers":["tryfigures.com"]}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.864396,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0xc00019ce70"}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.8652277,"msg":"autosaved config","file":"/var/lib/caddy/.config/caddy/autosave.json"}
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.8654559,"logger":"admin.api","msg":"load complete"}
Feb 13 16:20:49 figures-website systemd[1]: Reloaded Caddy.
Feb 13 16:20:49 figures-website caddy[1104]: {"level":"info","ts":1644769249.99203,"logger":"tls.issuance.acme.acme_client","msg":"trying to solve challenge","identifier":"tryfigures.com","challenge_type":"tls-alpn-01","ca":"https://acme-v02.api.letsencrypt.org/directory"}
Feb 13 16:20:50 figures-website caddy[1104]: {"level":"info","ts":1644769250.189515,"logger":"tls","msg":"served key authentication certificate","server_name":"tryfigures.com","challenge":"tls-alpn-01","remote":"18.116.86.117:62290"}
Feb 13 16:20:50 figures-website caddy[1104]: {"level":"info","ts":1644769250.304307,"logger":"tls","msg":"served key authentication certificate","server_name":"tryfigures.com","challenge":"tls-alpn-01","remote":"66.133.109.36:47456"}
Feb 13 16:20:50 figures-website caddy[1104]: {"level":"info","ts":1644769250.3123791,"logger":"tls","msg":"served key authentication certificate","server_name":"tryfigures.com","challenge":"tls-alpn-01","remote":"34.219.87.132:34516"}
Feb 13 16:20:50 figures-website caddy[1104]: {"level":"info","ts":1644769250.355632,"logger":"tls","msg":"served key authentication certificate","server_name":"tryfigures.com","challenge":"tls-alpn-01","remote":"18.192.36.99:16750"}
Feb 13 16:20:50 figures-website caddy[1104]: {"level":"info","ts":1644769250.364408,"logger":"admin","msg":"stopped previous server"}
Feb 13 16:20:50 figures-website caddy[1104]: {"level":"info","ts":1644769250.673429,"logger":"tls.issuance.acme.acme_client","msg":"validations succeeded; finalizing order","order":"https://acme-v02.api.letsencrypt.org/acme/order/407506630/63641688980"}
Feb 13 16:20:51 figures-website caddy[1104]: {"level":"info","ts":1644769251.1413736,"logger":"tls.issuance.acme.acme_client","msg":"successfully downloaded available certificate chains","count":2,"first_url":"https://acme-v02.api.letsencrypt.org/acme/cert/035a245be5c3abb907c7724a54a410866ef6"}
Feb 13 16:20:51 figures-website caddy[1104]: {"level":"info","ts":1644769251.1425476,"logger":"tls.obtain","msg":"certificate obtained successfully","identifier":"tryfigures.com"}
Feb 13 16:20:51 figures-website caddy[1104]: {"level":"info","ts":1644769251.1427863,"logger":"tls.obtain","msg":"releasing lock","identifier":"tryfigures.com"}
Feb 13 16:34:25 figures-website systemd[1]: Reloading Caddy.
Feb 13 16:34:25 figures-website caddy[21610]: {"level":"info","ts":1644770065.4432976,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Feb 13 16:34:25 figures-website caddy[21610]: reload: adapting config using caddyfile: parsing caddyfile tokens for 'root': /etc/caddy/Caddyfile:13 - Error during parsing: Wrong argument count or unexpected line ending after 'root'
Feb 13 16:34:25 figures-website systemd[1]: caddy.service: Control process exited, code=exited status=1
Feb 13 16:34:25 figures-website systemd[1]: Reload failed for Caddy.
Feb 13 16:34:42 figures-website systemd[1]: Reloading Caddy.
Feb 13 16:34:42 figures-website caddy[21617]: {"level":"info","ts":1644770082.7843702,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Feb 13 16:34:42 figures-website caddy[1104]: {"level":"info","ts":1644770082.7879424,"logger":"admin.api","msg":"received request","method":"POST","host":"localhost:2019","uri":"/load","remote_addr":"127.0.0.1:55160","headers":{"Accept-Encoding":["gzip"],"Content-Length":["283"],"Content-Type":["application/json"],"Origin":["localhost:2019"],"User-Agent":["Go-http-client/1.1"]}}
Feb 13 16:34:42 figures-website caddy[1104]: {"level":"info","ts":1644770082.788797,"logger":"admin.api","msg":"config is unchanged"}
Feb 13 16:34:42 figures-website caddy[1104]: {"level":"info","ts":1644770082.7890775,"logger":"admin.api","msg":"load complete"}
Feb 13 16:34:42 figures-website systemd[1]: Reloaded Caddy.
Feb 13 16:39:03 figures-website caddy[1104]: {"level":"info","ts":1644770343.9256701,"logger":"admin.api","msg":"received request","method":"GET","host":"localhost:2019","uri":"/config/","remote_addr":"127.0.0.1:55162","headers":{"Accept":["*/*"],"User-Agent":["curl/7.58.0"]}}
Feb 13 18:36:04 figures-website caddy[1104]: {"level":"info","ts":1644777364.387978,"logger":"admin.api","msg":"received request","method":"POST","host":"localhost:2019","uri":"/stop","remote_addr":"127.0.0.1:55170","headers":{"Accept-Encoding":["gzip"],"Content-Length":["0"],"Origin":["localhost:2019"],"User-Agent":["Go-http-client/1.1"]}}
Feb 13 18:36:04 figures-website caddy[1104]: {"level":"info","ts":1644777364.3880281,"logger":"admin.api","msg":"unloading"}
Feb 13 18:36:05 figures-website caddy[1104]: {"level":"info","ts":1644777365.3885179,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0xc00019c310"}
Feb 13 18:36:05 figures-website caddy[1104]: {"level":"info","ts":1644777365.3886387,"logger":"admin.api","msg":"unloading completed"}
Feb 13 18:36:05 figures-website caddy[1104]: {"level":"info","ts":1644777365.8891401,"logger":"admin","msg":"stopped previous server"}
Feb 13 18:36:05 figures-website caddy[1104]: {"level":"info","ts":1644777365.8892074,"logger":"admin.api","msg":"stopping now, bye!! 👋"}
Feb 13 18:36:05 figures-website systemd[1]: caddy.service: Failed with result 'exit-code'.
Feb 13 18:38:41 figures-website systemd[1]: Starting Caddy...
Feb 13 18:38:41 figures-website caddy[24678]: caddy.HomeDir=/var/lib/caddy
Feb 13 18:38:41 figures-website caddy[24678]: caddy.AppDataDir=/var/lib/caddy/.local/share/caddy
Feb 13 18:38:41 figures-website caddy[24678]: caddy.AppConfigDir=/var/lib/caddy/.config/caddy
Feb 13 18:38:41 figures-website caddy[24678]: caddy.ConfigAutosavePath=/var/lib/caddy/.config/caddy/autosave.json
Feb 13 18:38:41 figures-website caddy[24678]: caddy.Version=v2.4.6 h1:HGkGICFGvyrodcqOOclHKfvJC0qTU7vny/7FhYp9hNw=
Feb 13 18:38:41 figures-website caddy[24678]: runtime.GOOS=linux
Feb 13 18:38:41 figures-website caddy[24678]: runtime.GOARCH=amd64
Feb 13 18:38:41 figures-website caddy[24678]: runtime.Compiler=gc
Feb 13 18:38:41 figures-website caddy[24678]: runtime.NumCPU=1
Feb 13 18:38:41 figures-website caddy[24678]: runtime.GOMAXPROCS=1
Feb 13 18:38:41 figures-website caddy[24678]: runtime.Version=go1.17.2
Feb 13 18:38:41 figures-website caddy[24678]: os.Getwd=/
Feb 13 18:38:41 figures-website caddy[24678]: LANG=C.UTF-8
Feb 13 18:38:41 figures-website caddy[24678]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
Feb 13 18:38:41 figures-website caddy[24678]: NOTIFY_SOCKET=/run/systemd/notify
Feb 13 18:38:41 figures-website caddy[24678]: HOME=/var/lib/caddy
Feb 13 18:38:41 figures-website caddy[24678]: LOGNAME=caddy
Feb 13 18:38:41 figures-website caddy[24678]: USER=caddy
Feb 13 18:38:41 figures-website caddy[24678]: INVOCATION_ID=f62827b6bde6474fbe7641a856af9dc0
Feb 13 18:38:41 figures-website caddy[24678]: JOURNAL_STREAM=9:139733
Feb 13 18:38:41 figures-website caddy[24678]: {"level":"info","ts":1644777521.9021733,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Feb 13 18:38:41 figures-website systemd[1]: Started Caddy.
Feb 13 18:38:41 figures-website caddy[24678]: run: loading initial config: loading new config: starting caddy administration endpoint: listen tcp 127.0.0.1:2019: bind: address already in use
Feb 13 18:38:42 figures-website systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Feb 13 18:38:42 figures-website systemd[1]: caddy.service: Failed with result 'exit-code'.
Feb 13 19:19:02 figures-website systemd[1]: Starting Caddy...
Feb 13 19:19:02 figures-website caddy[2535]: caddy.HomeDir=/var/lib/caddy
Feb 13 19:19:02 figures-website caddy[2535]: caddy.AppDataDir=/var/lib/caddy/.local/share/caddy
Feb 13 19:19:02 figures-website caddy[2535]: caddy.AppConfigDir=/var/lib/caddy/.config/caddy
Feb 13 19:19:02 figures-website caddy[2535]: caddy.ConfigAutosavePath=/var/lib/caddy/.config/caddy/autosave.json
Feb 13 19:19:02 figures-website caddy[2535]: caddy.Version=v2.4.6 h1:HGkGICFGvyrodcqOOclHKfvJC0qTU7vny/7FhYp9hNw=
Feb 13 19:19:02 figures-website caddy[2535]: runtime.GOOS=linux
Feb 13 19:19:02 figures-website caddy[2535]: runtime.GOARCH=amd64
Feb 13 19:19:02 figures-website caddy[2535]: runtime.Compiler=gc
Feb 13 19:19:02 figures-website caddy[2535]: runtime.NumCPU=1
Feb 13 19:19:02 figures-website caddy[2535]: runtime.GOMAXPROCS=1
Feb 13 19:19:02 figures-website caddy[2535]: runtime.Version=go1.17.2
Feb 13 19:19:02 figures-website caddy[2535]: os.Getwd=/
Feb 13 19:19:02 figures-website caddy[2535]: LANG=C.UTF-8
Feb 13 19:19:02 figures-website caddy[2535]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
Feb 13 19:19:02 figures-website caddy[2535]: NOTIFY_SOCKET=/run/systemd/notify
Feb 13 19:19:02 figures-website caddy[2535]: HOME=/var/lib/caddy
Feb 13 19:19:02 figures-website caddy[2535]: LOGNAME=caddy
Feb 13 19:19:02 figures-website caddy[2535]: USER=caddy
Feb 13 19:19:02 figures-website caddy[2535]: INVOCATION_ID=f2cd0a2415f24152ab71704a4dcb7f38
Feb 13 19:19:02 figures-website caddy[2535]: JOURNAL_STREAM=9:152113
Feb 13 19:19:02 figures-website caddy[2535]: {"level":"info","ts":1644779942.1605313,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Feb 13 19:19:02 figures-website systemd[1]: Started Caddy.
Feb 13 19:19:02 figures-website caddy[2535]: run: loading initial config: loading new config: starting caddy administration endpoint: listen tcp 127.0.0.1:2019: bind: address already in use
Feb 13 19:19:02 figures-website systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Feb 13 19:19:02 figures-website systemd[1]: caddy.service: Failed with result 'exit-code'.
Feb 13 19:25:40 figures-website systemd[1]: Starting Caddy...
Feb 13 19:25:40 figures-website caddy[2592]: caddy.HomeDir=/var/lib/caddy
Feb 13 19:25:40 figures-website caddy[2592]: caddy.AppDataDir=/var/lib/caddy/.local/share/caddy
Feb 13 19:25:40 figures-website caddy[2592]: caddy.AppConfigDir=/var/lib/caddy/.config/caddy
Feb 13 19:25:40 figures-website caddy[2592]: caddy.ConfigAutosavePath=/var/lib/caddy/.config/caddy/autosave.json
Feb 13 19:25:40 figures-website caddy[2592]: caddy.Version=v2.4.6 h1:HGkGICFGvyrodcqOOclHKfvJC0qTU7vny/7FhYp9hNw=
Feb 13 19:25:40 figures-website caddy[2592]: runtime.GOOS=linux
Feb 13 19:25:40 figures-website caddy[2592]: runtime.GOARCH=amd64
Feb 13 19:25:40 figures-website caddy[2592]: runtime.Compiler=gc
Feb 13 19:25:40 figures-website caddy[2592]: runtime.NumCPU=1
Feb 13 19:25:40 figures-website caddy[2592]: runtime.GOMAXPROCS=1
Feb 13 19:25:40 figures-website caddy[2592]: runtime.Version=go1.17.2
Feb 13 19:25:40 figures-website caddy[2592]: os.Getwd=/
Feb 13 19:25:40 figures-website caddy[2592]: LANG=C.UTF-8
Feb 13 19:25:40 figures-website caddy[2592]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
Feb 13 19:25:40 figures-website caddy[2592]: NOTIFY_SOCKET=/run/systemd/notify
Feb 13 19:25:40 figures-website caddy[2592]: HOME=/var/lib/caddy
Feb 13 19:25:40 figures-website caddy[2592]: LOGNAME=caddy
Feb 13 19:25:41 figures-website caddy[2592]: USER=caddy
Feb 13 19:25:41 figures-website caddy[2592]: INVOCATION_ID=f221603b846543f1b0e7e95a8194ac53
Feb 13 19:25:41 figures-website caddy[2592]: JOURNAL_STREAM=9:152767
Feb 13 19:25:41 figures-website caddy[2592]: {"level":"info","ts":1644780340.9994795,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Feb 13 19:25:41 figures-website caddy[2592]: {"level":"info","ts":1644780341.0055287,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
Feb 13 19:25:41 figures-website caddy[2592]: {"level":"info","ts":1644780341.0070024,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
Feb 13 19:25:41 figures-website caddy[2592]: {"level":"info","ts":1644780341.0073159,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Feb 13 19:25:41 figures-website caddy[2592]: {"level":"info","ts":1644780341.0081794,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["tryfigures.com"]}
Feb 13 19:25:41 figures-website caddy[2592]: {"level":"info","ts":1644780341.0167086,"msg":"autosaved config (load with --resume flag)","file":"/var/lib/caddy/.config/caddy/autosave.json"}
Feb 13 19:25:41 figures-website systemd[1]: Started Caddy.
Feb 13 19:25:41 figures-website caddy[2592]: {"level":"info","ts":1644780341.0199392,"msg":"serving initial configuration"}
Feb 13 19:25:41 figures-website caddy[2592]: {"level":"info","ts":1644780341.02017,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000284cb0"}
Feb 13 19:25:41 figures-website caddy[2592]: {"level":"info","ts":1644780341.0202212,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/var/lib/caddy/.local/share/caddy"}
Feb 13 19:25:41 figures-website caddy[2592]: {"level":"info","ts":1644780341.020827,"logger":"tls","msg":"finished cleaning storage units"}

You’re getting status 403 back from Caddy. That means that there was a permission problem in reading the files from disk. Make sure the files you want to serve are owned by either the www-data user or by the caddy user.

That did it! www-data didn’t work but the caddy user did. Now I just need to figure out how to modify the file’s owner on upload so I don’t have to ssh in every time I change a file.

Thanks so much for guiding me through this!

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.