docker-gen icon indicating copy to clipboard operation
docker-gen copied to clipboard

[Help] Working SSL on localhost?

Open Riankas opened this issue 9 years ago • 3 comments

Hi, first of all it's more likely that this is not an issue, probably I did something wrong (I'm not an expert!) :D What I'm trying to do is to have the jwilder proxy container to route all my requests! And for now it's working! I have the proxy container, then a laravel installation (laradock) and some more lamp containers with other small websites. Everyone have their VIRTUAL_HOST set and all those virtual hosts redirect on 127.0.0.1 (edited host file). What I can't do is to get working HTTPS on my computer (OSX with native docker); i'm trying with https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion but maybe I'm doing something wrong... Do you have some advices on how to get this done correctly? Thanks!

Riankas avatar Oct 05 '16 07:10 Riankas

Let's encrypt won't issue an SSL cert for localhost. There's nothing you can do about that.

OmgImAlexis avatar Feb 08 '17 06:02 OmgImAlexis

here's my workaround. Let's assume you own domain example.com.

  1. in your DNS you make A record *.local.example.com -> 127.0.0.1
  2. go to letsencrypt and get *.local.example.com wildcard cert.
  3. put this certificates into certs folder and name them site.local.example.com.chain.crt site.local.example.com.crt site.local.example.com.key
  4. in docker-compose you set env VIRTUAL_HOST: site.local.example.com

You don't need letsencrypt-nginx-proxy-companion for this.

bstuff avatar May 04 '18 11:05 bstuff

I would say that it's definitely possible. Go through this tutorial to generate root ssl cert and "localhost" domain cert: https://medium.freecodecamp.org/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec

After that just add rootCA.pem to your trusted Authorities in Chrome.

And that's it. "https://localhost/" with secure connection. Just put the localhost.key and localhost.crt in the same directory where letsencrypt created default.key. In my case it was: "- ./certs:/etc/nginx/certs:rw"

adrianglazer avatar May 14 '19 20:05 adrianglazer

This repo should no longer handle issues or discussions related to nginx-proxy / the nginx-proxy template, unless there is something we need to change / fix in docker-gen in order to allow a change / fix in nginx-proxy.

buchdag avatar May 16 '24 12:05 buchdag