'caddy start' on Windows quits process when terminal is closed

1. The problem I’m having:

When I start Caddy (using caddy start, the server runs fine, but when I close the terminal I used to start it, the server stops. I expect it to run in the background.

2. Error messages and/or full log output:

2023/04/28 20:45:52.124 INFO    using adjacent Caddyfile
2023/04/28 20:45:52.125 WARN    Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies   {"adapter": "caddyfile", "file": "Caddyfile", "line": 14}
2023/04/28 20:45:52.128 INFO    admin   admin endpoint started  {"address": "localhost:2019", "enforce_origin": false, "origins": ["//[::1]:2019", "//127.0.0.1:2019", "//localhost:2019"]}
2023/04/28 20:45:52.130 INFO    tls.cache.maintenance   started background certificate maintenance      {"cache": "0xc000af0230"}
2023/04/28 20:45:52.131 INFO    http    skipping automatic certificate management because one or more matching certificates are already loaded  {"domain": "webterm.rfl890.cf", "server_name": "srv0"}
2023/04/28 20:45:52.131 INFO    http    skipping automatic certificate management because one or more matching certificates are already loaded  {"domain": "home.rfl890.cf", "server_name": "srv0"}
2023/04/28 20:45:52.131 INFO    http    enabling automatic HTTP->HTTPS redirects        {"server_name": "srv0"}
2023/04/28 20:45:52.131 INFO    http    enabling HTTP/3 listener        {"addr": ":443"}
2023/04/28 20:45:52.132 INFO    http.log        server running  {"name": "srv0", "protocols": ["h1", "h2", "h3"]}
2023/04/28 20:45:52.132 INFO    http.log        server running  {"name": "remaining_auto_https_redirects", "protocols": ["h1", "h2", "h3"]}
2023/04/28 20:45:52.132 INFO    tls     cleaning storage unit   {"description": "FileStorage:C:\\Users\\user\\AppData\\Roaming\\Caddy"}
2023/04/28 20:45:52.133 INFO    autosaved config (load with --resume flag)      {"file": "C:\\Users\\user\\AppData\\Roaming\\Caddy\\autosave.json"}
2023/04/28 20:45:52.133 INFO    serving initial configuration
Successfully started Caddy (pid=11952) - Caddy is running in the background
2023/04/28 20:45:52.134 INFO    tls     finished cleaning storage units

3. Caddy version:

v2.6.4

4. How I installed and ran Caddy:

I downloaded it from the website, and ran the executable

a. System environment:

Windows 11 x64

b. Command:

caddy start

c. Service/unit/compose file:

d. My complete Caddy config:

home.rfl890.cf {
	tls C:\somecert.pem C:\somekey.pem
	file_server {
		root C:\somefolder
		browse
	}
}
webterm.rfl890.cf {
	tls C:\somecert.pem C:\somekey.pem
	reverse_proxy http://localhost:1337
	basicauth {
		<user> <hash>
	}
}

see the keep caddy running with 2 ways to run a caddy service on windows.
also see the docs on the start command

1 Like

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