DocsSecuritySSL/TLS Certificates
Security 5 min read

SSL/TLS Certificates

Install and manage SSL certificates for encrypted connections.

SSL/TLS Certificates

Let's Encrypt (Free)

Installation with Certbot

bash
apt install certbot -y

# For Nginx
apt install python3-certbot-nginx -y
certbot --nginx -d yourdomain.com -d www.yourdomain.com

# For Apache
apt install python3-certbot-apache -y
certbot --apache -d yourdomain.com -d www.yourdomain.com

Auto-Renewal

Certbot automatically adds a renewal cron job. Verify it:

bash
certbot renew --dry-run

Wildcard Certificates

bash
certbot certonly --manual --preferred-challenges dns \
  -d "*.yourdomain.com" -d "yourdomain.com"

SSL Configuration Best Practices

Nginx SSL Config

nginx
server {
    listen 443 ssl http2;
    server_name yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

    # Modern SSL configuration
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
    ssl_prefer_server_ciphers off;

    # HSTS
    add_header Strict-Transport-Security "max-age=63072000" always;

    # OCSP Stapling
    ssl_stapling on;
    ssl_stapling_verify on;
}

# Redirect HTTP to HTTPS
server {
    listen 80;
    server_name yourdomain.com;
    return 301 https://$server_name$request_uri;
}

Testing SSL

Use these tools to verify your SSL configuration:

  • SSL Labs: ssllabs.com/ssltest
  • Command line: openssl s_client -connect yourdomain.com:443
  • Certificate info: echo | openssl s_client -connect yourdomain.com:443 2>/dev/null | openssl x509 -text
Need help? Chat with us!