Skip to content

Managing your own SSL certificates (without Cloudflare)

Most installs do not need this page. If your domains are proxied through Cloudflare, Cloudflare provides SSL for every domain and you can skip everything below. See Installing FunnelFlux.

Use this page when:

  • a domain’s DNS is not on Cloudflare, or you do not want it proxied, and
  • you want visitors to get HTTPS on that domain without a certificate warning.

The installer sets up one catch-all Nginx site, /etc/nginx/sites-available/funnelflux. It answers on HTTP and HTTPS for any domain, using a self-signed certificate for HTTPS. Browsers show a warning for that certificate, so a domain that visitors reach directly needs a real one.

Leave the catch-all site alone. For each domain that needs its own certificate, add a separate Nginx site for that domain and let Certbot install a free Let’s Encrypt certificate into it. Every other domain keeps using the catch-all.

Do not run Certbot against the catch-all site itself. Its server_name _; line does not match any domain, so Certbot stops with Could not automatically find a matching server block.

  • The domain’s A record must point straight at the server IP. Check it with dig +short tracker.example.com; it must return the server IP, not Cloudflare addresses.
  • If the domain is on Cloudflare but you want your own certificate, set the record to DNS only (grey cloud) first.
  • Ports 80 and 443 must be open. The installer’s firewall already allows both.

Replace tracker.example.com with your domain in every command.

  1. SSH into the server as root.

  2. Create a site for the domain from a copy of the catch-all site, and enable it:

    Terminal window
    D=tracker.example.com
    sudo cp /etc/nginx/sites-available/funnelflux /etc/nginx/sites-available/$D
    sudo sed -i "s/server_name _;/server_name $D;/" /etc/nginx/sites-available/$D
    sudo ln -s /etc/nginx/sites-available/$D /etc/nginx/sites-enabled/
    sudo nginx -t && sudo systemctl reload nginx
  3. Install Certbot and its Nginx plugin:

    Terminal window
    sudo apt-get install -y certbot python3-certbot-nginx
  4. Request and install the certificate:

    Terminal window
    sudo certbot --nginx -d tracker.example.com

    Certbot asks for an email address for expiry notices and asks you to accept the Let’s Encrypt terms. It replaces the self-signed certificate in the new site and adds an HTTP-to-HTTPS redirect for this domain only.

  5. Check that HTTPS works without a warning:

    Terminal window
    curl -I https://tracker.example.com

Repeat these steps for each domain that needs its own certificate. To put several names on one certificate, list them all on both server_name lines of the new site, separated by spaces, and pass a -d flag for each name to Certbot.

Let’s Encrypt certificates expire after 90 days. The Ubuntu Certbot package installs a systemd timer that renews them automatically, so you do not need a cron job.

Check the timer and test renewal:

Terminal window
systemctl list-timers certbot.timer
sudo certbot renew --dry-run

To stop using your own certificate for a domain, disable its site and reload Nginx. The domain then falls back to the catch-all site.

Terminal window
sudo rm /etc/nginx/sites-enabled/tracker.example.com
sudo nginx -t && sudo systemctl reload nginx
sudo certbot delete --cert-name tracker.example.com