Caddy logs not showing up

1. The problem I’m having:

I’m using Caddy API to load JSON config.

{
  "admin": {
    "disabled": false
  },
  "apps": {
    "http": {
      "servers": {
        "srv0": {
          "listen": [
            ":443"
          ],
          "routes": [
            {
              "handle": [
                {
                  "handler": "headers",
                  "response": {
                    "set": {
                      "Referrer-Policy": [
                        "same-origin"
                      ],
                      "X-Content-Type-Options": [
                        "nosniff"
                      ],
                      "X-Frame-Options": [
                        "DENY"
                      ],
                      "X-Xss-Protection": [
                        "1; mode=block"
                      ]
                    }
                  }
                },
                {
                  "handler": "subroute",
                  "routes": [
                    {
                      "handle": [
                        {
                          "handler": "vars",
                          "root": "/var/www/html/frontend/dist/"
                        }
                      ]
                    },
                    {
                      "handle": [
                        {
                          "handler": "rewrite",
                          "uri": "{http.matchers.file.relative}"
                        }
                      ],
                      "match": [
                        {
                          "file": {
                            "try_files": [
                              "{http.request.uri.path}",
                              "{http.request.uri.path}/",
                              "/index.html"
                            ]
                          }
                        }
                      ]
                    },
                    {
                      "handle": [
                        {
                          "encodings": {
                            "gzip": {},
                            "zstd": {}
                          },
                          "handler": "encode"
                        },
                        {
                          "handler": "file_server",
                          "hide": [
                            "Caddyfile"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "logs": {}
        }
      }
    },
    "tls": {
      "automation": {
        "on_demand": {
          "ask": "https://example.io/custom-domain/ssl-allowed/"
        },
        "policies": [
          {
            "on_demand": true
          }
        ]
      }
    }
  }
}

A domain pointed to the server is not generating SSL certification. I need to check the logs but can’t find any log file in /var/log/caddy directory, even there is no caddy directory in the $HOME/.local/share/ directory.

2. Error messages and/or full log output:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

3. Caddy version:

v2.4.5 h1:P1mRs6V2cMcagSPn+NWpD+OEYUYLIf6ecOa48cFGeUg=

4. How I installed and ran Caddy:

Caddy installed using apt (ubuntu) and configuration loaded using Caddy API

a. System environment:

Ubuntu 20.04

b. Command:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

c. Service/unit/compose file:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

d. My complete Caddy config:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

5. Links to relevant resources:

The logs are printed to stdout/stderr. It depends how you’re running Caddy where that will go. See Keep Caddy Running — Caddy Documentation for more details.

Caddy is running using the Caddy API /load/ method, no other configuration is done.

sudo service caddy status gives

Active: inactive (dead)

But how did you start Caddy in the first place? Clearly it’s not running as a service because your service is inactive (which is not a good thing – you really should run Caddy as a service).

And please completely fill out the help topic template, as per the forum rules. There’s a big lack of information here, so we can’t do much to help.