# Caddy as an NSSM service

2.3.0

### 2. How I run Caddy:

I currently run it through cmd on windows 10 - caddy start

### 3. The problem I’m having:

I’m wondering how caddy can be installed as a service using nssm, to use the Caddyfile, instead of providing arguments. Or is this not possible?

1 Like

You can specify command args when installing a service with NSSM.

Simply specify the --config flag.

1 Like

My NSSM setup looks like this:

.\nssm.exe install caddy C:\path\to\caddy\caddy.exe
.\nssm.exe set caddy AppExit Default Restart

2 Likes

I’ve tried both creating my own and using --config to point to the Caddyfile, and the NSSM cmd line set up, both of which get the below whenever I try to start the service:

Your user probably needs to be an administrator to be able to bind to ports 80 and 443, probably. Services can be finicky on Windows.

My user is an administrator, however the service is set to “log on as” Local System. I did just set the log on as to myself but it’s still giving me this same error.

Have you redirected stdout and stderr to log files?

If so, is there anything in there?

Caddy’s pretty much always got something to say, even if it can’t start up - might point us in the right direction on why it’s not working in your case.

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