I set up caddy as a service in windows using the following command (powershell):
sc.exe create caddy start= auto binPath= "C:\ProgramData\chocolatey\bin\caddy.exe run --config C:/Caddyfile".
When I run
sc.exe start caddy the terminal is hung and in the “Services” app in windows, the Status shows as “Starting”.
The server seems to be working, I can get the expected response from the server when it is called, and no longer get a response after I run
It’s just hung in the “Starting” status and when I use ctrl+C in the powershell terminal, it is no longer hung, but the service then has a status of “Stopped”, but the caddy server still works. I still have to call
caddy stop to stop the server.
When I call
sc.exe stop caddy after ctrl+C, it prints an error saying the service has not been started, but the caddy server is still listening.
I eventually get a Windows error from the Services app saying the following when trying to start the service using the GUI:
Windows could not start the caddy service on Local Computer.
Error 1053: The service did not respond to the start of control request in a timely fashion.
The Services app shows a loading bars for a while before this.
choco install caddy
sc.exe start caddy
Microsoft Windows Server 2022 Standard, x64
Given in section 1.
Not at liberty to share, but using
auto_https off and
tls cert.pem key.pem