# HTTPS and certificates

> Free certificates from Let's Encrypt, ZeroSSL or Google Trust Services, DNS-01 validation, wildcards and your own certificate.

HTTPS is on by default for new sites. On the site's **General** pane, **HTTPS and certificate** shows the state: **HTTPS until …**, **HTTPS pending** (waiting for the first certificate) or **HTTPS failed**. **Turn on HTTPS** / **Turn off HTTPS** switch it. With HTTPS on, HTTP redirects to it. If the first certificate of a new site cannot be issued, Zefily retries automatically after 10 minutes, 30 minutes and 2 hours (three times at most); until then the state shows **HTTPS pending, retrying at …**.

## Before you start

Point the domain (and every alias) to the server with `A`/`AAAA` records. A certificate can only be issued once the names resolve to the server — or with DNS-01 validation.

## Certificate authority

- **Let's Encrypt** (default) and **ZeroSSL** issue free certificates.
- **Google Trust Services** issues free certificates too. The first GTS certificate on a server needs an external
  account key from your Google Cloud project: enable the Public CA API, run
  `gcloud publicca external-account-keys create` in Cloud Shell and paste its **keyId** and **b64MacKey** into the
  form that opens. The key is single use: it registers the server's GTS account, which later sites on the same server
  reuse (leave the fields empty then). It is sent sealed to the server and never stored by Zefily.
- **Own certificate**: paste your certificate chain (leaf first, then intermediates) and its private key in PEM and **Install certificate**. The key is stored encrypted and sent sealed to the server. The panel shows **Own certificate until …** and reminds you before it expires.

- **Let's Encrypt** needs no email address: the account is registered without one, so a server that changes owner keeps no address of the previous owner.
- **ZeroSSL** registers its account for the email address of the person who requests the certificate, and renewals keep that account. A request with a different address (for example after a server transfer) registers a new ZeroSSL account with a new key; the old one stays at ZeroSSL.
- **After a server transfer**, ZeroSSL sites are requested again for the receiving owner, and Google Trust Services sites move to Let's Encrypt and their GTS account is dropped from the server. The receiving owner gets a notice. See [Transfer to another organization](/docs/server-overview).

## Certificate request (CSR)

For a certificate from a commercial authority (an OV/EV certificate, or one your organization buys), open the site's **General** pane and use **Certificate request (CSR)**: choose the names, the key type (ECDSA P-256 is the default; RSA 2048 or 4096 if your authority needs it) and optionally your organization and country, then **Make CSR**. The private key is made on your server and never leaves it; the panel shows the CSR to copy to the authority.

When the authority issues the certificate, paste it with its intermediate certificates under **Custom certificate** and leave the key empty: the server pairs it with the key it kept. Making a new CSR replaces the waiting key, so only the latest CSR can be completed. The certificate is not renewed automatically; request a new one before it expires (the site shows its expiry date).

## Domain validation

- **HTTP-01 (port 80)** works when the domain points to the server and port 80 is reachable. Before any order is sent, the agent checks that the name answers here: its public `A`/`AAAA` records include one of the server's addresses, or the challenge path answers from the server (a name behind Cloudflare's proxy passes this way). If it does not, the site keeps serving HTTP, the HTTPS settings show **waiting for DNS** with the reason, and Zefily asks again on a backoff (5 minutes, doubling up to 6 hours). Nothing is sent to Let's Encrypt in the meantime, so the failed-validation limits are not used up. The agent also requests the challenge path from the server itself, on the address the name points to: when the name has an `AAAA` record, the site must answer over IPv6, because Let's Encrypt validates over IPv6 first. Both nginx and OpenLiteSpeed listen on IPv4 and IPv6 (on a server whose kernel has IPv6 turned off, on IPv4 only); the job log names the address that did not answer.
- **DNS-01 via** a DNS provider works behind a proxy such as Cloudflare, for servers not reachable on port 80, and for **wildcard** aliases. Connect the provider under **Settings → DNS providers** (Cloudflare, Route 53, DigitalOcean, Hetzner — see [Integrations](/docs/integrations)) and select it here. The server keeps the DNS key to renew on its own.

## Redirect and HSTS

With HTTPS on, two more settings appear under **HTTPS and certificate**:

- **Redirect HTTP to HTTPS** (on by default): `http://` requests get a permanent redirect to `https://`. **Don't redirect** serves the site on both, for the rare client that cannot follow the redirect; the ACME challenge path always stays reachable on HTTP.
- **HSTS** (Strict-Transport-Security, one year by default): browsers remember to use only HTTPS for that long. Choose **Off**, **5 minutes (test)**, **1 day**, **30 days**, **6 months**, **1 year** or **2 years**; **Include subdomains** extends it to every subdomain, and **Preload list** (offered with a year or more and subdomains) marks the site for the browsers' built-in list — submit it at hstspreload.org yourself, and only when every subdomain works over HTTPS.

Raise HSTS step by step once HTTPS works everywhere: browsers keep what they saw until it expires, so turning HSTS off later does not reach them. HSTS for six months or more counts toward an A+ in the [security center](/docs/security-center). Both settings work on nginx and OpenLiteSpeed.

## Renewal

Certificates renew **on the server itself**, well before they expire, and renewal does not depend on the panel being reachable. Access rules (password protection, IP allowlists) never block renewals.

**Renew the certificate account.** The server keeps one account at each certificate authority its sites use. On the server's **Security** tab, **Renew account** deactivates the old account at that authority and removes its key on the server. The certificates already issued stay in place and keep working until they expire. The next renewal or new certificate registers a new account. Google Trust Services asks for a new external account key from your Google Cloud project first, and the new account is registered at once, so renewals keep working. If the authority refuses the deactivation, nothing changes and the job says why.

## Troubleshooting

- **Domain not pointing to the server yet**: HTTPS does not fail; the site waits and shows the **Waiting for DNS** reason. Zefily sends no request to the certificate authority meanwhile.
- **HTTPS failed**: check that the domain resolves to the server (`dig +short example.com`) and that port 80 is open in the [firewall](/docs/firewall-and-users). Behind Cloudflare's proxy, use DNS-01. A name that does not point to the server yet is not a failure: the site waits for DNS as described under domain validation. When the failure was a DNS problem right after the address record was created, the agent tries the order again twice (30 s, then 60 s) before it fails. **Retry certificate** (under HTTPS and certificate) sends the request again with the current settings; the reason of the last failure is in the server's Activity tab. A custom certificate has nothing to request.
- Each failed order counts toward Let's Encrypt's limit of five authorization failures per domain per hour, so do not retry in a loop ([rate limits](https://letsencrypt.org/docs/rate-limits/)).
- Let's Encrypt limits how many new certificates it issues (for example per week for one domain). When it delays yours, the site's HTTPS settings show the time to apply again. Until then the agent sends no new order, so repeated applies do not use up the limit. For a site that has no certificate yet, Zefily orders it again by itself once that time has passed (up to six times in a row); a one-click install such as WordPress goes on meanwhile, and the site answers over HTTP until the certificate arrives. A renewal that keeps failing waits an hour, then longer each time, up to a day.
- When a new site still has no certificate after the automatic attempts (three after a failed validation, six after rate limits), the site's HTTPS settings say it answers over HTTP only, and the organization's owner gets an email and a bell notice with the last error. Fix the cause (the name must point to the server, port 80 must be open), then press **Retry certificate**.

---
Source: https://zefily.com/docs/https-certificates
