Caddy wont use Caddyfile

Solved:

Ok, I figure it out. The port was excluded from this service I had “World Wide Web Publishing Service”. I don’t know where that came from, but I disabled the serviced and now caddy is working perfectly again!

1. Caddy version (caddy version):

2.4.5

2. How I run Caddy:

I just want to run it to run a static file and have it redirect my dynamic dns to https.

a. System environment:

Windows 10

b. Command:

caddy.exe start

c. Service/unit/compose file:

NONE

d. My complete Caddyfile or JSON config:

Caddyfile: (first part of address changed for privacy)

mydns.tplinkdns.com

root * C:/Users/a1/www/root/
file_server

3. The problem I’m having:

When I try to start caddy with my Caddyfile there, it doesn’t even use it. I did have it working at first and it was fine, so I don’t know what I did. I cant even use a basic caddyfile from the tutorial anymore either.

4. Error messages and/or full log output:

C:\Users\a1>caddy.exe start
2021/10/11 02:11:26.067 INFO    using adjacent Caddyfile
2021/10/11 02:11:26.077 INFO    admin   admin endpoint started  {"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["[::1]:2019", "127.0.0.1:2019", "localhost:2019"]}
2021/10/11 02:11:26.077 INFO    tls.cache.maintenance   started background certificate maintenance      {"cache": "0xc00037eee0"}
2021/10/11 02:11:26.077 INFO    http    server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {"server_name": "srv0", "https_port": 443}
2021/10/11 02:11:26.078 INFO    http    enabling automatic HTTP->HTTPS redirects        {"server_name": "srv0"}
2021/10/11 02:11:26.081 INFO    tls.cache.maintenance   stopped background certificate maintenance      {"cache": "0xc00037eee0"}
run: loading initial config: loading new config: http app module: start: tcp: listening on :80: listen tcp :80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
start: caddy process exited with error: exit status 1

5. What I already tried:

Since I did have it working before, I uninstalled, searched my computer for any folder referencing caddy or caddyfile and deleted and then I tried to start over, even going back to following the tutorial but it wont work. As you an see the output says its using the adjacent Caddyfile, but in fact my Caddyfile has nothing about port 2019 and I don’t know what its talking about the socket.

6. Links to relevant resources:

None

Ok, I just tested the whole thing on a different computer and it works fine. I guess the issue is more with that socket error. Not sure what that’s about.

Ok, I think I found the issue:

PS C:\Users\a1> netsh interface ipv4 show excludedportrange protocol=tcp

Protocol tcp Port Exclusion Ranges

Start Port End Port


    80          80
    • Administered port exclusions.

So port 80 is excluded somehow. How can I free them back up?

Ok, I figure it out. The port was excluded from this service I had “World Wide Web Publishing Service”. I don’t know where that came from, but I disabled the serviced and now caddy is working perfectly again!

2 Likes

Howdy @Ditch_Magnet, welcome to the Caddy community and thank you for posting your solution! :smiley: Nice work troubleshooting it so fast :gun:

1 Like

Hi, and thanks!
Yeah, I just figured putting my solution up top would hopefully help someone else out someday.

1 Like