1. The problem I’m having:
I ran the site with the following configuration and the page was blank after accessing via http, but it was accessible normally via https.
If I change the configuration to the following, I can access it normally again using http://pic.domain2.com.
pic.domain1.com, pic.domain2.com:80 {
root * /www/wwwroot/pic.domain2.com/public
php_fastcgi php-fpm:9000
file_server
}
2. Error messages and/or full log output:
To protect the site, I replaced the logs and the domain in the configuration file. But I don’t see any valid information from the logs
{"level":"info","ts":1686548029.5510778,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
{"level":"warn","ts":1686548029.5630326,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":3}
{"level":"info","ts":1686548029.5704167,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
{"level":"info","ts":1686548029.5726993,"logger":"http","msg":"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}
{"level":"warn","ts":1686548029.573492,"logger":"http","msg":"automatic HTTP->HTTPS redirects are disabled","server_name":"srv0"}
{"level":"warn","ts":1686548029.573579,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv1","http_port":80}
{"level":"info","ts":1686548029.5787704,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
{"level":"info","ts":1686548029.5789237,"msg":"failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/quic-go/quic-go/wiki/UDP-Receive-Buffer-Size for details."}
{"level":"info","ts":1686548029.5790515,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
{"level":"info","ts":1686548029.5791352,"logger":"http.log","msg":"server running","name":"srv1","protocols":["h1","h2","h3"]}
{"level":"info","ts":1686548029.5792065,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["tool.rainss.cn","pic.suger.live","pic.rainss.cn","api.rainss.cn","suger.live","rainss.cn"]}
{"level":"info","ts":1686548029.5850537,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000441730"}
{"level":"info","ts":1686548029.5852144,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}
{"level":"info","ts":1686548029.5861866,"logger":"tls","msg":"finished cleaning storage units"}
{"level":"info","ts":1686548029.5866659,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
{"level":"info","ts":1686548029.5867283,"msg":"serving initial configuration"}
3. Caddy version:
v2.6.4 h1:2hwYqiRwk1tf3VruhMpLcYTg+11fCdr8S3jhNAdnPy8=
4. How I installed and ran Caddy:
Docker 20.10.5+dfsg1
a. System environment:
Debian GNU/Linux 11 (bullseye)
b. Command:
c. Service/unit/compose file:
version: '3.2'
services:
webservice:
container_name: caddy
image: caddy:latest
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- /etc/localtime:/etc/localtime
- /opt/caddy/Caddyfile:/etc/caddy/Caddyfile
- /opt/caddy/config:/config
- /opt/caddy/data:/data
- /www/wwwroot:/www/wwwroot
depends_on:
- php-cgi
restart: always
networks:
- website
php-cgi:
container_name: php-fpm
image: rainautos/php-fpm:8.1.15
volumes:
- /etc/localtime:/etc/localtime
- /www/wwwroot:/www/wwwroot
restart: always
networks:
- website
networks:
website:
external: true
d. My complete Caddy config:
{
email example@example.com
auto_https disable_redirects
}
pic.domain1.com, pic.domain2.com {
root * /www/wwwroot/pic.domain2.com/public
php_fastcgi php-fpm:9000
file_server
}