Self-host on LetsEncrypt server with SSL certificates
Getting a domain
First of all, you need to buy a domain mydomain.com
When self-hosting, we want to make sure our website can be reached securely via https and for this we need the domain to go through CloudFlare.
Setting up CloudFlare
- Log in on CloudFlare
- Add a new website
mydomain.com - Get the new NS records to use (i.e.
jerry.ns.cloudflare.comandrafe.ns.cloudflare.com)
Routing domain through CloudFlare
- From the domain provider panel, make sure the domain uses the CloudFlare NS records. It might be necessary to manually request this to the provider.
- The initial status will be
Pending Nameserver Update. Wait until it becomesActive(it is possible to manually refresh with theRe-check nowbutton.
Generating new SSL certificate with LetsEncrypt
- If a LetsEncrypt docker image is already running, stop the container
docker stop letsencryptand delete itdocker rm letsencrypt. - Create now a new docker image for LetsEncrypt, making sure that
mydomain.comis included in the certificate details as a main domain or as extra domains.
docker create \
--name=letsencrypt \
--cap-add=NET_ADMIN \
-e PUID=1027 \
-e PGID=100 \
-e TZ=Europe/Stockholm \
-e URL=mymaindomain.com \
-e SUBDOMAINS=wildcard \
-e EXTRA_DOMAINS=www.mydomain.com,www.myotherdomain.com \
-e VALIDATION=dns \
-e DNSPLUGIN=cloudflare \
-e EMAIL=email@email.com \
-e DHLEVEL=2048\
-e ONLY_SUBDOMAINS=false\
-e STAGING=false\
-p 1443:443 \
-p 1080:80 \
-p 9443:8443 \
-v /volume1/docker/letsencrypt/config:/config \
--restart unless-stopped \
linuxserver/letsencrypt
Keep in mind that every domain listed needs to be routed through CloudFlare.