ByteInternet / hypernode-docker

Fast and easy Docker for Magento development
https://community.hypernode.io/hypernode-docker
35 stars 8 forks source link

Is it possible to use SSL on localhost? #56

Open Aquive opened 2 years ago

Aquive commented 2 years ago

Is it possible to use SSL on localhost? I found this guide: https://letsencrypt.org/docs/certificates-for-localhost/ Which generates the keys. Is it possible to use those, and how?

Thanks!

vdloo commented 2 years ago

@Aquive I don't really have a ready to go answer for that. I'd go with a self signed certificate in the container if I had to set up something like that. You could configure SSL in the NGINX inside the hypernode-docker just like you could with any other NGINX installation, but for letsencrypt validation of course is the issue (the normal acme challenge of course can't reach your local container). And whether or not letsencrypt allows you to create a certificate for localhost I don't exactly know.

I'd:

frosit commented 2 years ago

Why would you need SSL on localhost? There should be no restrictions due to SSL because it's localhost.

I use let's encrypt with the dehydrated command to generate certificates for my docker/WSL environment. If you point a subdomain to localhost or your LAN IP (containing docker), you can use let's encrypt with DNS verification instead of http verification to generate them. This allows me to have a an actual certificate on my instance while browsing my site from other devices within my LAN. Doesn't require you to mess with nginx or setting up self signed certificates at all.

I use a dehydrated hook script for this, if this is what you're looking for i can put it in a gist. Some like: dehydrated -c --hook dnshook.sh --challenge dns-01