How to use SSL?
anonrig opened this issue · 6 comments
Hello,
I couldn't find a proper example of using FORCE_SSL option with a SSL I gathered from LetsEncrypt?
How should I do it?
Best
So I use it with CloudFlare's Full SSL option, which is: secure connection between your visitor and CloudFlare, and secure connection (but not authenticated) between CloudFlare and your server.
So the docker image automatically creates a self-signed certificate which is used when you use FORCE_SSL on your container. So setup something like CloudFlare, enable the SSL on CloudFlare and FORCE_SSL on your container, and you will have full SSL from your visitor all the way to your server.
Hope that helps
Thank you for your response. So, the env variable for nginx should have a key of FORCE_SSL and what should be the value of this env variable?
No, the Env (FORCE_SSL) should be on the web service container you want to balance and not the Nginx proxy container. Just like the VIRTUAL_HOST, that way some web services can have SSL and others not.
Something like this:
my-app:
environment:
- VIRTUAL_HOST=example.com www.example.com
- FORCE_SSL=true
expose:
- '80'
image: 'my_image:latest'
Thanks!