Closed crrazyman closed 1 year ago
hi, please test it once without the Nginx like this:
version: '2.4'
services:
acme-ca-server:
image: knrdl/acme-ca-server:0.2.3
restart: always
environment:
EXTERNAL_URL: http://192.168.221.10:8080
DB_DSN: postgresql://postgres:secret@db/postgres
CA_ENCRYPTION_KEY: U0PgnP9rqlOsw1P5Z9Lj0BDVcRZEatA8OcomQSR9vLw=
WEB_ENABLE_PUBLIC_LOG: true
WEB_APP_TITLE: ACME CA Test
+ ports:
+ - "8080:8080"
networks:
- net
volumes:
- ./ca.key:/import/ca.key:ro # needed once to import new ca
- ./ca.pem:/import/ca.pem:ro # needed once to import new ca
mem_limit: 250m
My guess is that the Nginx changes the upstream hostname into "acme-acme-ca-server-1". But as a security measure the ACME server checks if the request hostname equals the one from the EXTERNAL_URL
env var. If you show me your nginx template I can try to reproduce it.
Thanks for the quick response. Yes that solved my problem, thank you!!!
This is my nginx template config
server {
listen 8080;
server_name ${NGINX_HOST};
location / {
proxy_pass http://${ACME_SERVER_NAME}:${ACME_SERVER_PORT}/;
}
}
And this is the nginx container from docker-compose
acme_proxy:
image: nginx:1.22.1-alpine
restart: always
ports:
- "8080:8080"
networks:
- net
environment:
- NGINX_HOST=acme.com
- ACME_SERVER_NAME=acme-acme-ca-server-1
- ACME_SERVER_PORT=8080
volumes:
- ./nginx/templates:/etc/nginx/templates
How should i set it in order to get it working?
this prevents nginx from changing the request host header into the respective upstream value:
server {
listen 8080;
server_name ${NGINX_HOST};
location / {
proxy_pass http://${ACME_SERVER_NAME}:${ACME_SERVER_PORT}/;
+ proxy_set_header Host $http_host;
}
}
Thanks, it worked!
Hello,
I have setup acme ca server with this docker-compose:
Basically acme_proxy acts as a reverse proxy for acme-ca-server. I know it's HTTP, it's just for testing purposes, will configure nginx to server HTTPS after.
The problem i have is that i can't get it to work, i've tried with certbot and also with acme.sh clients:
certbot docker (as in README.md):
certbot client:
certbot logs:
acme.sh with debug: