1. Caddy version (caddy version
):
Caddy2
2. How I run Caddy:
Official docker container
a. System environment:
ubuntu 20, docker everything
b. Command:
Paste command here.
c. Service/unit/compose file:
version: '3'
networks:
docker_dbnet_shared:
name: ${DOCKER_DBNETWORK_NAME}
caddy:
image: caddy:2
container_name: caddy
restart: always
ports:
- 80:80 # Needed for the ACME HTTP-01 challenge.
- 443:443
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- ./caddy-config:/config
- ./caddy-data:/data
- ${DOCKER_APPDATA_PATH}/caddy/www:/srv
environment:
- EMAIL=some@email.com # The email address to use for ACME registration.
- LOG_FILE=/data/accesscaddy.log
mysql_db: ######### MySQL shared instance (docker only, no host apps access)
image: mysql:latest
container_name: MySQL_DB
restart: always
networks:
- docker_dbnet_shared
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
ports:
- 3306:3306
volumes:
- ${DOCKER_APPDATA_PATH}/mysql/data:/var/lib/mysql
- ${DOCKER_APPDATA_PATH}/mysql/config:/etc/mysql/conf.d
monica_crm: ######### Monica CRM - personal CRM
image: monica:fpm
container_name: Monica_CRM
networks:
- docker_dbnet_shared
restart: always
depends_on:
- mysql_db
env_file:
- .env_monicaCRM
environment:
- DB_HOST=MySQL_DB
# - APP_ENV=production
volumes:
- ${DOCKER_APPDATA_PATH}/caddy/www/monicacrm:/var/www/html/storage
d. My complete Caddyfile or JSON config:
#Monica CRM
some.website {
header {
X-Robots-Tag "noindex"
}
tls {$EMAIL}
log {
output file /data/monicacrmaccess.log {
roll_size 10MB
roll_keep 10
}
level ERROR
format json
}
root * /srv/monicacrm
php_fastcgi 172.19.0.3:9000
file_server
}
3. The problem I’m having:
Can’t reach MonicaCRM container when using URL - some.website
4. Error messages and/or full log output:
{“level”:“error”,“ts”:1639433825.3632703,“logger”:“http.log.access.log2”,“msg”:“handled request”,“request”:{“remote_addr”:“73.245.241.235:10203”,“proto”:“HTTP/2.0”,“method”:“GET”,“host”:“mon.nomid.ws”,“uri”:"/",“headers”:{“Dnt”:[“1”],“Upgrade-Insecure-Requests”:[“1”],“Sec-Fetch-Mode”:[“navigate”],“Sec-Fetch-User”:["?1"],“Cache-Control”:[“max-age=0”],“Te”:[“trailers”],“User-Agent”:[“Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0”],“Accept-Encoding”:[“gzip, deflate, br”],“Sec-Fetch-Dest”:[“document”],“Sec-Fetch-Site”:[“none”],“Accept”:[“text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,/;q=0.8”],“Accept-Language”:[“en-US,ru;q=0.5”]},“tls”:{“resumed”:false,“version”:772,“cipher_suite”:4865,“proto”:“h2”,“proto_mutual”:true,“server_name”:“mon.nomid.ws”}},“common_log”:“73.245.241.235 - - [13/Dec/2021:22:17:05 +0000] “GET / HTTP/2.0” 404 0”,“duration”:0.000242509,“size”:0,“status”:404,“resp_headers”:{“X-Robots-Tag”:[“noindex”],“Server”:[“Caddy”]}}
{“level”:“info”,“ts”:1639434827.3938856,“logger”:“http.log.access.log0”,“msg”:“handled request”,“request”:{“remote_addr”:“73.245.241.235:10351”,“proto”:“HTTP/2.0”,“method”:“GET”,“host”:“mon.nomid.ws”,“uri”:"/",“headers”:{“Sec-Fetch-Site”:[“none”],“Sec-Fetch-User”:["?1"],“Te”:[“trailers”],“Accept”:[“text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,/;q=0.8”],“Accept-Language”:[“en-US,ru;q=0.5”],“Dnt”:[“1”],“Upgrade-Insecure-Requests”:[“1”],“User-Agent”:[“Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0”],“Accept-Encoding”:[“gzip, deflate, br”],“Sec-Fetch-Dest”:[“document”],“Sec-Fetch-Mode”:[“navigate”]},“tls”:{“resumed”:false,“version”:772,“cipher_suite”:4865,“proto”:“h2”,“proto_mutual”:true,“server_name”:“mon.nomid.ws”}},“common_log”:“73.245.241.235 - - [13/Dec/2021:22:33:47 +0000] “GET / HTTP/2.0” 0 0”,“duration”:0.000122822,“size”:0,“status”:0,“resp_headers”:{“Server”:[“Caddy”],“X-Robots-Tag”:[“noindex”]}}
{“level”:“info”,“ts”:1639434827.6388557,“logger”:“http.log.access.log0”,“msg”:“handled request”,“request”:{“remote_addr”:“73.245.241.235:10351”,“proto”:“HTTP/2.0”,“method”:“GET”,“host”:“mon.nomid.ws”,“uri”:"/favicon.ico",“headers”:{“Referer”:[“https://mon.nomid.ws/"],“Sec-Fetch-Dest”:[“image”],“Sec-Fetch-Mode”:[“no-cors”],“Te”:[“trailers”],“User-Agent”:["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0”],“Accept-Language”:[“en-US,ru;q=0.5”],“Accept-Encoding”:[“gzip, deflate, br”],“Dnt”:[“1”],“Sec-Fetch-Site”:[“same-origin”],“Accept”:[“image/avif,image/webp,/”]},“tls”:{“resumed”:false,“version”:772,“cipher_suite”:4865,“proto”:“h2”,“proto_mutual”:true,“server_name”:“mon.nomid.ws”}},“common_log”:“73.245.241.235 - - [13/Dec/2021:22:33:47 +0000] “GET /favicon.ico HTTP/2.0” 0 0”,“duration”:0.000196214,“size”:0,“status”:0,“resp_headers”:{“Server”:[“Caddy”],“X-Robots-Tag”:[“noindex”]}}
5. What I already tried:
Different options in caddyfile, checked that containers see each other. Checked nginx config from monica CRM docker example - ```
https://raw.githubusercontent.com/monicahq/docker/master/.examples/nginx-proxy/web/nginx.conf
### 6. Links to relevant resources:
MonicaCRM FPM version uses nginx as web server. https://hub.docker.com/_/monica
I followed their guide except using caddy.
https://github.com/monicahq/docker/tree/master/.examples