Hello,
I am complete newbie in caddy. I am running caddy version v2.2.1 h1:Q62GWHMtztnvyRU+KPOpw6fNfeCD3SkwH7SfT1Tgt2c=
on manjaro system. I am following documentation with a sample configuration.
I have a simple index.html in a directory and following Caddyfile in the same directory
localhost:2015
file_server
when I run caddy run
in the directory, I receive
2021/01/17 09:00:05.463 INFO using adjacent Caddyfile
2021/01/17 09:00:05.465 INFO admin admin endpoint started {"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["localhost:2019", "[::1]:2019", "127.0.0.1:2019"]}
2021/01/17 09:00:05.466 INFO http enabling automatic HTTP->HTTPS redirects {"server_name": "srv0"}
2021/01/17 09:00:05.466 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc0004709a0"}
2021/01/17 09:00:05.498 INFO tls setting internal issuer for automation policy that has only internal subjects but no issuer configured {"subjects": ["localhost"]}
run: loading initial config: loading new config: http app module: start: tcp: listening on :80: listen tcp :80: bind: permission denied
However if I give the command via CLI like caddy run file_server -listen :2015
, everything works as expected.
I validated the file with caddy validate. I activated debug global option, I receive following output.
2021/01/17 09:02:13.146 INFO using adjacent Caddyfile
2021/01/17 09:02:13.148 INFO admin admin endpoint started {"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["localhost:2019", "[::1]:2019", "127.0.0.1:2019"]}
2021/01/17 09:02:13.149 INFO http enabling automatic HTTP->HTTPS redirects {"server_name": "srv0"}
2021/01/17 09:02:13.149 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc0003ca9a0"}
2021/01/17 09:02:13.182 INFO tls setting internal issuer for automation policy that has only internal subjects but no issuer configured {"subjects": ["localhost"]}
2021/01/17 09:02:13.183 INFO tls cleaned up storage units
2021/01/17 09:02:13.329 INFO pki.ca.local root certificate is already trusted by system {"path": "storage:pki/authorities/local/root.crt"}
2021/01/17 09:02:13.329 DEBUG http starting server loop {"address": "[::]:2015", "http3": false, "tls": true}
run: loading initial config: loading new config: http app module: start: tcp: listening on :80: listen tcp :80: bind: permission denied
I have disabled auto_https via global section. it removed the permission error, that removed port 80 permission error but the site is not being served as expected. index.html file is not being served.
I believe documentation is missing or outdated. The simple Caddyfile does not work as described in the documentation or I misunderstood something.
Any help much appreciated.