I just created a new Laravel 8 project, following the instructions in their docs. Using Laravel Sail I have the site running locally on my machine just fine using sail up
. I have set up an entry in /etc/hosts
so the url I go to is http://local.dev.domain.com
(substituting domain.com
for the actual domain name I own, and pointing to localhost
in the /etc/hosts
file)...all works great.
However, the site needs to use Facebook Login, and Facebook requires https urls only on referrers. I've tried everything I could find online about setting up SSL certs with docker, but setting up nginx with manually created certs (via mkcert
) or trying to use letsencrypt all fails for various reasons (conflicts in ports, letsencrypting wanting the domain to be a real one (and failing on the acme challenge if I do create that subdomain), etc. I've copied the certs to /etc/ssl/certs
in the docker image and run update-ca-certificates
, tried setting the application port 443
in my .env
file as well as opening both ports 80
and 443
in the docker-compose.yml
file...but all ends in the browser rejecting the request to https://local.dev.domain.com
I've spent hours trying to get this to work but it doesn't seem like anyone has used the Laravel Sail docker image with SSL.
Any pointers?
[Edit for more info]
As pointed out in the comments, you need to set an alias to just use sail ...
, but I've already done that:
I also tried without the bash alias using vendor/bin/sail share
to no avail: