Caddy2 on Windws

1. My Caddy version (caddy version):

Version 2

2. How I run Caddy:

caddy.exe start

a. System environment:

Windows 10, No Docker

d. My complete Caddyfile or JSON config:

{
    # email to use on Let's Encrypt
    email bla
    
    # Uncomment for debug
    #acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
    #debug
}

# Add gzip compression to requests
(webconf) {
  encode gzip
}

# Add forward headers to requests
(theheaders) {
    header_up X-Forwarded-Ssl on
    header_up Host {host}
    header_up X-Real-IP {remote}
    header_up X-Forwarded-For {remote}
    header_up X-Forwarded-Port {server_port}
    header_up X-Forwarded-Proto {scheme}
    header_up X-Url-Scheme {scheme}
    header_up X-Forwarded-Host {host}
}

example.com, www.example.com {
    root * /www/
    file_server
    import webconf
}

jenkins.example.com {
    reverse_proxy http://127.0.0.1:9080 {
      import theheaders
    }
    import webconf
}

3. The problem I’m having:

Caddy could not start because it can not bind port 2019, which is not in use.

4. Error messages and/or full log output:

2020/05/05 09:26:28.881 e[34mINFOe[0m using adjacent Caddyfile
run: loading initial config: loading new config: starting caddy administration endpoint: listen tcp 127.0.0.1:2019: bind: Der Zugriff auf einen Socket war aufgrund der Zugriffsrechte des Sockets unzulässig.
start: caddy process exited with error: exit status 1

5. What I already tried:

Use Adminmode

Caddy v2 uses port 2019 by default for the admin API.

You have two options. You can either change the admin endpoint to listen to a different port that won’t conflict with your system, or you can turn off the admin endpoint entirely. Turning it off will prevent the caddy reload command for graceful reloads from working; it’s recommended to leave it enabled.

For example, to change the listen address, you can put this at the top of your Caddyfile:

{
    admin localhost:3019
}

You can read more about global options here:

Thank you, i got it finally to work :slight_smile: now i just have to find out where the www have to be :slight_smile:

Is 2019 a protected port on Windows??

I dont know, i’ve checked with cPorts, and 2019 was not used. But caddy didn’t like it for a unknown reason :confused:

I’m using Caddy v2 from beta on Windows 10 and haven’t experienced this issue.

So I think this is a personal environmental issue.

That translates to English as something along the lines of “Access to a socket was not permitted due to the socket’s access rights,” which is not a “socket is in use” error.

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