Caddy
無論 Caddyfile 中的地址如何,Caddy 總是嘗試綁定到埠 80
Caddy v2.2.1 似乎不尊重給定地址的埠
Caddyfile
:myfinedomain.com:9999 { respond "Nothing to see here. Srsly." }
啟動 caddy 只會導致以下錯誤(取自日誌):
{"level":"info","ts":1614777947.500496,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"} {"level":"info","ts":1614777947.5004952,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0002d2380"} run: loading initial config: loading new config: http app module: start: tcp: listening on :80: listen tcp :80: bind: address already in use start: caddy process exited with error: exit status 1 {"level":"info","ts":1614778157.9187949,"msg":"using provided configuration","config_file":"/usr/local/etc/caddy/Caddyfile","config_adapter":"caddyfile"} {"level":"info","ts":1614778157.9210048,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["[::1]:2019","127.0.0.1:2019","localhost:2019"]} {"level":"info","ts":1614778157.9213488,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"} {"level":"info","ts":1614778157.92195,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0002be3f0"} run: loading initial config: loading new config: http app module: start: tcp: listening on :80: listen tcp :80: bind: address already in use start: caddy process exited with error: exit status 1
因此,caddy 似乎嘗試綁定到埠 80,這是不應該的。
該文件將埠列為地址的有效選項。
對這裡可能缺少的東西的想法表示讚賞。
這是導致解釋發生了什麼的線索:
{"level":"info","ts":1614778157.9213488,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
查找此內容可以解釋 Caddy自動嘗試將 HTTP 重定向到 HTTPS 並管理 TLS 證書,除非在各種情況下,例如使用者明確禁用該功能。
如果您不打算執行 HTTPS 網站,則應明確禁用此功能,或考慮使用不同的 Web 伺服器。