Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated configuration not working properly #1116

Closed
kfitgitds24 opened this issue Mar 27, 2024 · 0 comments
Closed

Automated configuration not working properly #1116

kfitgitds24 opened this issue Mar 27, 2024 · 0 comments

Comments

@kfitgitds24
Copy link

kfitgitds24 commented Mar 27, 2024

Currently setting up a server, where I run nginx-proxy together with jrcs/letsencrypt-nginx-proxy-companion. From logs I noticed the companion tried getting new certificates after each docker compose up, until it reached rate limit. I investigated further and found out the nginx.tmpl is written in a way that instructs the companion to look for certificates and keys with .crt and .key extensions (respectively), but the companion obtained certificates and keys all end with .pem. Also the pathing per domain never worked.

Okay so I changed the nginx.tmpl to fit my configuration, by doing this:
`

ssl_certificate /etc/nginx/certs/{{ $vhost.cert }}/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/{{ $vhost.cert }}/key.pem;

# For dhparam.pem, since it's stored directly under /etc/nginx/certs/

        {{- if (exists "/etc/nginx/certs/dhparam.pem") }}
ssl_dhparam /etc/nginx/certs/dhparam.pem;
        {{- end }}

# For chain.pem, adjust the path to be within the vhost's directory

        {{- if (exists (printf "/etc/nginx/certs/%s/chain.pem" $vhost.cert)) }}
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate {{ printf "/etc/nginx/certs/%s/chain.pem" $vhost.cert }};
        {{- end }}

`
And surprisingly, when I left the containers running overnight, in the morning everything ran as it should - the letsencrypt companion saw the certificates, didn't try to acquire new ones. Then I restarted containers and the same old "rate limit" is here.

My nginx.tmpl still has the changes inside, but when I run manually docker-gen /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf in my nginx-proxy container, the resulting default.conf file says "No certificate found for this vhost, so use the default certificate...". Automated runs (like scheduled nginx -s reload) always end up over-writing the default.conf file.

Any ideas on why is this happening?

@buchdag buchdag transferred this issue from nginx-proxy/docker-gen May 16, 2024
@nginx-proxy nginx-proxy locked and limited conversation to collaborators May 16, 2024
@buchdag buchdag converted this issue into discussion #1117 May 16, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant