How to Get SSL Certificates for NGINX Running in Docker Without a Loop?

0
0
Asked By SillySocks42 On

I'm running into a bit of a catch-22 while setting up NGINX with SSL certificates in Docker. I have a Node.js server on port 3000, and I want to set up NGINX in another Docker container to act as a reverse proxy for it. The problem is that my NGINX configuration needs SSL certificates to set up HTTPS and redirect from HTTP, but Let's Encrypt requires NGINX to be running to issue those certificates. How can I break this loop in my Docker setup?

3 Answers

Answered By CoolCoder88 On

You can start by setting up NGINX to listen on port 80 first. Then, run Let's Encrypt. It'll automatically configure port 443 and set up the redirect from port 80 to 443 for you, solving the issue a lot more seamlessly!

Answered By DockerDude99 On

What you can do is run NGINX initially without any SSL settings. Use Certbot to get your certificate, and then update your NGINX virtual host configuration to include SSL with the newly obtained certificate. If you're looking for an easier option, you might want to consider using a Docker reverse proxy like Caddy or Traefik, as they'll handle SSL automation for you!

CuriousCat22 -

So, I need to prepare an NGINX config without SSL first, launch the container, then run a Certbot container, and after that, I can update the NGINX config with SSL? That's quite the process!

Answered By NetworkNinja77 On

Just a quick thought—does Certbot work well with NGINX when both are set up inside Docker?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.