Turn on the debug global option. Thisβll make Caddy show more details in the logs for what might be going wrong.
Are you sure /public is correct? Do you actually have a /public directory at the root of your filesystem? If you mean for this to be a relative path, use ./public or public instead.
I updated the public path to relative ./public and also to absolute path, but I got the same results.
I tried also root ./public, file_server without browse, got the same results.
.
βββ apps
β βββ auth-service
β β βββ main.py
β βββ discovery-service
β β βββ main.py
β βββ processing-service
β β βββ main.py
β βββ user-service
β βββ main.py
βββ caddy # binary which I run with `./caddy run`
βββ Caddyfile
βββ public
βββ index.html
βββ script.js
Caddy logs:
$ ./caddy run
2022/07/11 05:18:23.063 INFO using adjacent Caddyfile
2022/07/11 05:18:23.063 WARN Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies {"adapter": "caddyfile", "file": "Caddyfile", "line": 3}
2022/07/11 05:18:23.064 INFO admin admin endpoint started {"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["//127.0.0.1:2019", "//localhost:2019", "//[::1]:2019"]}
2022/07/11 05:18:23.064 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc000270b60"}
2022/07/11 05:18:23.064 WARN http server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server {"server_name": "srv0", "http_port": 80}
2022/07/11 05:18:23.064 DEBUG http starting server loop {"address": "[::]:80", "http3": false, "tls": false}
2022/07/11 05:18:23.064 INFO tls cleaning storage unit {"description": "FileStorage:/home/acmt/.local/share/caddy"}
2022/07/11 05:18:23.065 INFO tls finished cleaning storage units
2022/07/11 05:18:23.071 INFO pki.ca.local root certificate is already trusted by system {"path": "storage:pki/authorities/local/root.crt"}
2022/07/11 05:18:23.071 INFO autosaved config (load with --resume flag) {"file": "/home/acmt/.config/caddy/autosave.json"}
2022/07/11 05:18:23.071 INFO serving initial configuration
When I go in browser to http://localhost/ or http://localhost nothing changes in logs.
A workaround would be just to create another service which will serve the static files.
It seems curl -v http://localhost returns the expected page.
I tried it on chrome, but I got This site canβt be reached.
Tried it on Firefox and it works!
Is Chrome forcing a redirect from HTTP to HTTPS? It might have cached a redirect that it doesnβt want to forget.
If so, you can use a different domain name for now, or just use 127.0.0.1 (update your Caddyfile to just http:// for your site block instead of localhost:80)