How to run the caddy as service on windows

Hi,

How to run caddy as a Service on windows. help me.

1. Caddy version (caddy version):

2. How I run Caddy:

a. System environment:

b. Command:

Paste command here.

c. Service/unit/compose file:

Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.

d. My complete Caddyfile or JSON config:

Paste config here, replacing this text.
Use `caddy fmt` to make it readable.
DO NOT REDACT anything except credentials.
LEAVE DOMAIN NAMES INTACT.
Make sure the backticks stay on their own lines.

3. The problem I’m having:

4. Error messages and/or full log output:

5. What I already tried:

6. Links to relevant resources:

This seems to be created in error. If it’s not a mistake, please fill out the template properly!

Have you read the docs?

Hi Francislavoie,

iam getting below error

c:\caddy>caddy-service.exe install
[ERROR] ‘install’ is not a recognized subcommand; see ‘caddy help’

c:\caddy>

I don’t think you renamed the right binary. You’re meant to rename the WinSW binary to caddy-service.exe, not caddy.exe to caddy-service.exe.

I did the same

c:>cd caddy

c:\caddy>dir
Volume in drive C has no label.
Volume Serial Number is 729A-5FF1

Directory of c:\caddy

09/01/2021 05:09 PM .
09/01/2021 05:09 PM …
09/01/2021 04:10 PM 34,619,904 caddy-service.exe
09/01/2021 05:09 PM 386 caddy-service.xml
2 File(s) 34,620,290 bytes
2 Dir(s) 319,473,954,816 bytes free

c:\caddy>caddy-service.exe install
[ERROR] ‘install’ is not a recognized subcommand; see ‘caddy help’

c:\caddy>

This tells me this is the caddy.exe binary you’re running, and not the WinSW binary.

Please try again, and follow the steps carefully.