Network security

How to Create an SSL Certificate: Free, Self-Signed & CSR Guide

Most sites should get a free Let's Encrypt certificate with Certbot. This guide covers that path, plus CSRs, paid certificates and self-signed testing certs.

Cysoro Security TeamPublished · 7 min read
NETWORK SECURITYSSLcertificateFree, CSR or self-signed.Padlock onLet's Encrypt · Free
Quick answer

To create an SSL certificate for a public website, use Let's Encrypt with Certbot: install Certbot, run sudo certbot --nginx -d example.com -d www.example.com, and Certbot will obtain, install and auto-renew the free 90-day certificate. For a paid certificate, generate a private key and CSR with OpenSSL, submit the CSR to a CA, prove domain control, and install the signed certificate. Self-signed certificates are only for local testing.

Key takeaways

  • Let's Encrypt with Certbot is the fastest free path for public sites, with automatic renewal of 90-day certificates.
  • A CSR contains your public key and domain names; your private key never leaves your server.
  • Self-signed certificates encrypt traffic but trigger browser warnings, so never use them on a public site.

An SSL certificate — technically a TLS certificate — proves your server really is the name it claims to be, and lets browsers set up an encrypted connection. For most websites the fastest path is free: Let's Encrypt with Certbot does the whole job in one command.

What is an SSL certificate, and how does it work?

An SSL certificate is an X.509 certificate that binds a public key to a domain name, signed by a Certificate Authority (CA) that browsers trust. When a visitor connects, the server presents the certificate, the browser checks the signature and the name, and the two sides agree on encryption keys.

The flow has six steps: generate a key pair, create a Certificate Signing Request (CSR), submit the CSR to a CA, prove you control the domain, receive the signed certificate, and install it with its intermediate chain on your web server. Let's Encrypt automates all six with the ACME protocol, which is why it is the recommended path for most sites.

Certificates come in three validation levels. Domain Validation (DV) proves you control the domain and takes seconds. Organization Validation (OV) also verifies the business identity. Extended Validation (EV) involves the deepest vetting. Let's Encrypt issues DV only, which is enough for almost every public site.

Which type of SSL certificate do you need?

Pick by situation, not by price. A public blog needs a free DV certificate, a wildcard needs DNS validation, and an internal tool needs a self-signed certificate or your own CA.

Your situationBest optionValidationTime to issue
Public website or blogLet's Encrypt, freeDVSeconds
Wildcard (*.example.com)Let's Encrypt via DNS-01, or paid CADVMinutes
Business identity must be vettedPaid OV or EV certificateOV / EVDays
Internal tool or local devSelf-signed with OpenSSL, or mkcertNoneInstant, untrusted
Internal network, many servicesYour own CAInternalHours to set up

A wildcard covers one level of subdomains only — *.example.com covers blog.example.com but not a.b.example.com — and it does not automatically cover the base domain unless you request it. If you need OV or EV, a warranty or special support, a paid CA such as DigiCert or Sectigo is the right choice.

How do you create a free SSL certificate with Let's Encrypt?

Let's Encrypt is a free, automated CA operated by the Internet Security Research Group. Its certificates are trusted by all major browsers, last 90 days, and renew automatically when you use Certbot.

First check whether your hosting provider already handles it. Many providers get and manage Let's Encrypt certificates for you automatically, or offer a one-click option. If yours does, enable it there and skip the commands below. If you run your own server, use Certbot, the recommended ACME client.

Prerequisites

You need a registered domain name with DNS records pointing to your server, and port 80 open in your firewall for the HTTP-01 challenge. You also need shell access with sufficient privileges to run commands and reload your web server.

Step 1: Install Certbot

On Ubuntu, install Certbot from the snap store with sudo snap install --classic certbot. On other systems, follow the instructions at certbot.eff.org for your operating system and web server. Certbot's site has excellent documentation for each combination.

Step 2: Obtain and install the certificate

With nginx running, run sudo certbot --nginx -d example.com -d www.example.com. Certbot finds the server block for those domains, adds the TLS directives, reloads nginx and sets up renewal. With Apache, use sudo certbot --apache -d example.com -d www.example.com.

If no web server is running, use sudo certbot certonly --standalone -d example.com -d www.example.com, which runs a temporary server for validation. If you already serve files, use sudo certbot certonly --webroot -w /var/www/html -d example.com instead.

Step 3: Find your certificate files

After a successful run, Certbot writes the files to /etc/letsencrypt/live/example.com/, including fullchain.pem and privkey.pem. Never share privkey.pem: it is your private key, and anyone with it can impersonate your site.

Step 4: Test renewal

Run sudo certbot renew --dry-run to test automatic renewal. Certbot installs a timer that renews certificates before they expire, so you should not need to renew manually. Check that the timer is active, and set a calendar reminder to verify the site still loads over HTTPS after the first renewal.

How do you create a CSR with OpenSSL for a paid certificate?

For a paid OV or EV certificate, you generate a private key and a CSR on your server, then submit the CSR to the CA. The CA verifies your domain and organization, signs your public key and returns a certificate to install.

The certificate lifecycle — your private key never leaves the server1. Your serverprivate key + CSRpublic key inside2. The CAvalidates domainHTTP, DNS or email3. Signed certleaf + intermediatechain returns4. Installcert + chain +private key on serverOnly the public key crosses to the CA. Guard the private key.Use RSA 3072 or ECDSA P-256 for the key — 2048-bit RSA is the older minimum.
How a CSR becomes a trusted certificate. Illustration by Cysoro.

Generate a new key and CSR in one command with openssl req -new -newkey rsa:3072 -nodes -keyout server.key -out server.csr. The -nodes flag means the key is not encrypted with a passphrase, which is normal for servers that must restart unattended. Alternatively, generate an ECDSA key with openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out server.key, then create the CSR from it.

When OpenSSL prompts for details, the critical field is the Common Name or Subject Alternative Name (SAN): it must list every domain the certificate should cover. Modern browsers ignore the Common Name and check SANs, so include each domain as a SAN. Submit the CSR file to your chosen CA, complete its domain validation — usually by adding a DNS TXT record or placing a file on your server — and install the certificate and intermediate chain it returns.

How do you create a self-signed certificate with OpenSSL?

A self-signed certificate is signed with its own private key, so no CA vouches for it. It encrypts traffic just as well as a CA-signed certificate, but browsers will warn that it is not trusted.

Create one in a single command: openssl req -x509 -newkey rsa:3072 -keyout server.key -out server.crt -days 365 -nodes. That generates a key and a certificate valid for 365 days. You can also sign an existing CSR with openssl x509 -signkey server.key -in server.csr -req -days 365 -out server.crt.

Use self-signed certificates only for local development, testing or internal tools where you control the trust store. For a smoother local workflow, consider mkcert, which creates a local CA and installs it in your browsers for you. Never use a self-signed certificate on a public site: the browser warning will scare visitors away and hurt search rankings.

Protect the private keySet restrictive permissions on the key file, such as 600, keep it off version control and backups that leave your server, and generate a new key if you ever suspect it leaked. A leaked private key means anyone can impersonate your site until the certificate is revoked and replaced.

How do you install and check the certificate?

Installation depends on your server, but the pattern is the same: point the server at the certificate file, the chain file and the private key, then reload and test. With Certbot's nginx or Apache plugin, this is done for you.

For nginx, the key directives are ssl_certificate pointing at fullchain.pem and ssl_certificate_key pointing at privkey.pem. For Apache, use SSLCertificateFile, SSLCertificateKeyFile and SSLCertificateChainFile as your distribution requires. After reloading, redirect HTTP to HTTPS and enable HSTS so browsers never fall back to plain HTTP.

Verify the result with our free SSL checker, which shows the certificate, chain, expiry and TLS version. If it reports a chain error, you probably installed the leaf certificate without its intermediate chain — install fullchain.pem instead of cert.pem.

Also check your headers with the security headers checker. Let's Encrypt's getting started guide and Ubuntu's TLS certificate guide cover the same steps in detail.

What mistakes should you avoid?

The most common mistakes are letting a certificate expire, installing the wrong chain, and using a self-signed certificate in production. All three are easy to prevent with monitoring and a checklist.

Before you go live — the certificate checklistExpiry monitoredalert 30 days beforeFull chain installeduse fullchain.pemSANs cover all domainsincluding wwwHTTP redirects to HTTPSno plain-HTTP pages leftHSTS enabledbrowsers refuse HTTPPrivate key protectedpermissions 600, never shared
Six checks before a certificate goes live. Illustration by Cysoro.
  • Forgetting renewal: paid certificates last one year and do not renew themselves. Use certificate monitoring and a calendar reminder.
  • Missing SANs: a certificate for example.com does not automatically cover www.example.com unless it is listed.
  • Wrong chain: installing only the leaf certificate causes chain errors in some browsers.
  • Mixed content: loading images or scripts over plain HTTP breaks the padlock even with a valid certificate.
  • Weak keys: use RSA 3072 or ECDSA P-256; older 1024-bit keys are no longer acceptable.

The bottom line

For a public site, create a free Let's Encrypt certificate with Certbot — it is fast, trusted and self-renewing. Use OpenSSL and a CSR only when you need a paid OV or EV certificate, and reserve self-signed certificates for testing.

Once installed, verify the certificate, chain and expiry with the free SSL checker, and set up monitoring so expiry never surprises you.

Frequently asked questions

How do I create an SSL certificate for free?

Use Let's Encrypt with Certbot. Install Certbot on your server, run sudo certbot --nginx -d example.com -d www.example.com, and Certbot will obtain and install a free certificate and set up automatic renewal. Many hosting providers also offer free Let's Encrypt certificates with one click.

What is the difference between SSL and TLS?

SSL is the older protocol; TLS is its successor and what browsers actually use today. People still say SSL certificate, but the certificate is technically an X.509 certificate for TLS. When you create one, you are creating a TLS certificate.

How long does an SSL certificate last?

Let's Encrypt certificates last 90 days and renew automatically with Certbot. Most paid certificates last one year. Self-signed certificates last as long as you set with the -days option, commonly 365 days.

What is a CSR?

A Certificate Signing Request is a file you send to a Certificate Authority. It contains your public key and identifying information such as domain names. The CA verifies you control the domain, then signs your public key and returns a certificate. Your private key never leaves your server.

Can I use a self-signed certificate on a public website?

You can, but you should not. Self-signed certificates encrypt traffic just as well, but browsers do not trust them and will show a warning that scares visitors away. Use them only for local development, testing or internal tools where you control the trust store.

What is a wildcard SSL certificate?

A wildcard certificate covers one level of subdomains, such as *.example.com, plus the base domain if requested. Let's Encrypt issues wildcard certificates through the DNS-01 challenge, which requires adding a TXT record to your DNS. Paid CAs also sell wildcard certificates.

How do I renew an SSL certificate?

Let's Encrypt certificates renew automatically if Certbot is installed and its timer is running; test it with sudo certbot renew --dry-run. Paid certificates must be renewed manually or through your provider, usually before the one-year expiry. Set a calendar reminder 30 days before expiry.

Sources

  1. Let's Encrypt — Getting Started
  2. Ubuntu — Obtain TLS certificates
  3. TechCommune — Creating TLS Certificates
  4. Inventive HQ — How to Create an SSL Certificate for Your Website
  5. Linux Journal — How to Secure Your Website with OpenSSL
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against Let's Encrypt getting-started guidance, Ubuntu TLS documentation and OpenSSL certificate guides.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free