1. Caddy version (caddy version
):
v2.0.0 installed via sudo apt install caddy
2. How I run Caddy:
a. System environment:
Ubuntu 20.04 desktop amd64
b. Command:
caddy file-server --domain localhost
and
caddy file-server --domain localhost --listen :8082
c. Service/unit/compose file:
N/A
d. My complete Caddyfile or JSON config:
N/A using CLI
3. The problem I’m having:
I am failing to get caddy to run because of port binding permissions (initially for 80/443) so I tried using a high port but I guess I am trying to set the port wrong because the log implies my port choice is ignored.
4. Error messages and/or full log output:
With:
caddy file-server --domain localhost
I get the below:
2020/05/19 12:28:15.087 WARN admin admin endpoint disabled
2020/05/19 12:28:15.087 INFO http server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {"server_name": "static", "https_port": 443}
2020/05/19 12:28:15.088 INFO http enabling automatic HTTP->HTTPS redirects {"server_name": "static"}
2020/05/19 13:28:15 [INFO][cache:0xc00027c730] Started certificate maintenance routine
2020/05/19 12:28:15.117 INFO tls setting internal issuer for automation policy that has only internal subjects but no issuer configured {"subjects": ["localhost"]}
2020/05/19 12:28:15.118 INFO tls cleaned up storage units
2020/05/19 12:28:15.188 INFO pki.ca.local root certificate is already trusted by system {"path": "storage:pki/authorities/local/root.crt"}
file-server: loading new config: http app module: start: tcp: listening on :443: listen tcp :443: bind: permission denied
So I tried to use a custom high port:
caddy file-server --domain localhost --listen :8082
This gives the error:
2020/05/19 12:28:15.087 WARN admin admin endpoint disabled
2020/05/19 12:28:15.087 INFO http server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {"server_name": "static", "https_port": 443}
2020/05/19 12:28:15.088 INFO http enabling automatic HTTP->HTTPS redirects {"server_name": "static"}
2020/05/19 13:28:15 [INFO][cache:0xc00027c730] Started certificate maintenance routine
2020/05/19 12:28:15.117 INFO tls setting internal issuer for automation policy that has only internal subjects but no issuer configured {"subjects": ["localhost"]}
2020/05/19 12:28:15.118 INFO tls cleaned up storage units
2020/05/19 12:28:15.188 INFO pki.ca.local root certificate is already trusted by system {"path": "storage:pki/authorities/local/root.crt"}
file-server: loading new config: http app module: start: tcp: listening on :443: listen tcp :443: bind: permission denied
5. What I already tried:
I’ve tried without --domain localhost
and that serves it over http with no redirect to https - I think I expect that to be the case.
I’ve also tried running with a caddyfile
localhost:8082
bind 127.0.0.1
root * Dist/web
file_server
and caddy start
but I get a different error:
2020/05/19 12:52:22.939 INFO using adjacent Caddyfile
run: loading initial config: loading new config: starting caddy administration endpoint: listen tcp 127.0.0.1:2019: bind: address already in use
start: caddy process exited with error: exit status 1
I also tried adding
http_port 8081
https_port 8082
but I think I was setting up the caddyfile wrong because I couldn’t get that to work either.
Caddyfile:3: unrecognized directive: http_port
6. Links to relevant resources:
N/A
I hope that there is something simple and blindingly obvious that I’m missing!