Skip to content

SSL Configuration

TractStack automatically handles SSL certificate management using Let’s Encrypt, with support for both automated and manual verification methods.

The simplest approach uses Cloudflare’s DNS API for automatic certificate issuance and renewal.

  1. Get API Token from Cloudflare dashboard:

    • Go to Cloudflare API Tokens
    • Create token with Zone:DNS:Edit permissions
    • Scope to your specific domain zone
  2. Create credentials file:

Terminal window
sudo mkdir -p /root/.secrets/certbot
sudo nano /root/.secrets/certbot/cloudflare.ini
  1. Add your API token:
dns_cloudflare_api_token = YOUR_API_TOKEN_HERE
  1. Secure the file:
Terminal window
sudo chmod 600 /root/.secrets/certbot/cloudflare.ini

With credentials in place, run the installer:

Terminal window
curl -fsSL https://get.tractstack.com | bash -s -- --prod --domain=yourdomain.com

The installer will:

  • Detect Cloudflare credentials
  • Automatically request wildcard certificates
  • Configure automatic renewal
  • Set up nginx with SSL

For other DNS providers, use manual verification during installation.

Run the installer without Cloudflare credentials:

Terminal window
curl -fsSL https://get.tractstack.com | bash -s -- --prod --domain=yourdomain.com

The installer will pause and display TXT records to add:

Please add the following TXT record to your DNS:
_acme-challenge.yourdomain.com TXT "abc123def456..."
_acme-challenge.yourdomain.com TXT "xyz789uvw012..."
For wildcard certificate, also add:
_acme-challenge.yourdomain.com TXT "wildcard-token..."

For Cloudflare (manual):

  1. Go to DNS settings in Cloudflare dashboard
  2. Add TXT records as shown
  3. Wait 1-2 minutes for propagation

For other providers:

  1. Access your DNS management panel
  2. Add the TXT records exactly as displayed
  3. Wait for DNS propagation (can take 5-15 minutes)

Check that records are visible:

Terminal window
dig _acme-challenge.yourdomain.com TXT
nslookup -type=TXT _acme-challenge.yourdomain.com

Once DNS records are added:

  1. Return to the installer terminal
  2. Press Enter to continue
  3. Let’s Encrypt will verify the records
  4. Certificates will be issued and installed

Covers only the specified domain:

  • yourdomain.com

Covers the domain and all subdomains:

  • yourdomain.com
  • *.yourdomain.com
  • www.yourdomain.com
  • blog.yourdomain.com
  • api.yourdomain.com

Multi-tenant installations automatically request wildcard certificates.

Certificates are stored at:

/home/t8k/etc/letsencrypt/live/yourdomain.com/
├── cert.pem # Certificate
├── chain.pem # Certificate chain
├── fullchain.pem # Certificate + chain
└── privkey.pem # Private key

Certificates auto-renew via systemd timer:

Terminal window
# Check renewal status
sudo -u t8k /home/t8k/certbot_venv/bin/certbot certificates
# View renewal timer
sudo systemctl status certbot-renew.timer
# Test renewal (dry run)
sudo -u t8k /home/t8k/certbot_venv/bin/certbot renew --dry-run

Force certificate renewal if needed:

Terminal window
sudo -u t8k /home/t8k/certbot_venv/bin/certbot renew --force-renewal
sudo systemctl reload nginx

TractStack automatically configures nginx with modern SSL settings:

# Strong SSL configuration
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
# Security headers
add_header Strict-Transport-Security "max-age=63072000" always;
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
server {
listen 80;
server_name yourdomain.com *.yourdomain.com;
return 301 https://$server_name$request_uri;
}
ssl_certificate /home/t8k/etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /home/t8k/etc/letsencrypt/live/yourdomain.com/privkey.pem;

DNS not propagated:

Terminal window
# Check DNS records
dig _acme-challenge.yourdomain.com TXT
# Wait longer for propagation
# Try again in 5-10 minutes

Rate limits exceeded:

Terminal window
# Let's Encrypt has rate limits
# Wait an hour and try again
# Use staging environment for testing:
sudo -u t8k /home/t8k/certbot_venv/bin/certbot certonly --staging

Certificate file not found:

Terminal window
# Check certificate files exist
sudo ls -la /home/t8k/etc/letsencrypt/live/yourdomain.com/
# Check nginx configuration
sudo nginx -t

Mixed content warnings:

Terminal window
# Ensure all resources use HTTPS
# Check browser console for HTTP resources
# Update any hardcoded HTTP URLs

Renewal fails:

Terminal window
# Check renewal logs
sudo -u t8k /home/t8k/certbot_venv/bin/certbot renew --dry-run
# Manual renewal with verbose output
sudo -u t8k /home/t8k/certbot_venv/bin/certbot renew -v

nginx reload fails:

Terminal window
# Test nginx configuration
sudo nginx -t
# Check for syntax errors
sudo systemctl status nginx

For enterprise or custom certificates:

  1. Place certificate files:
Terminal window
sudo mkdir -p /home/t8k/etc/ssl/
sudo cp yourdomain.crt /home/t8k/etc/ssl/
sudo cp yourdomain.key /home/t8k/etc/ssl/
sudo chown -R t8k:t8k /home/t8k/etc/ssl/
  1. Update nginx configuration:
Terminal window
sudo nano /etc/nginx/sites-enabled/t8k-main.conf
  1. Modify SSL paths:
ssl_certificate /home/t8k/etc/ssl/yourdomain.crt;
ssl_certificate_key /home/t8k/etc/ssl/yourdomain.key;
  1. Test and reload:
Terminal window
sudo nginx -t
sudo systemctl reload nginx

Verify SSL configuration:

Monitor certificate expiration:

Terminal window
# Check expiration dates
echo | openssl s_client -connect yourdomain.com:443 2>/dev/null | openssl x509 -noout -dates
# Set up monitoring alerts
# Many services available: UptimeRobot, Pingdom, etc.
Terminal window
# Backup certificate directory
sudo -u t8k tar -czf /home/t8k/backups/ssl-$(date +%Y%m%d).tar.gz \
/home/t8k/etc/letsencrypt/

For multiple domains on one server:

Terminal window
# Request additional certificate
sudo -u t8k bash -c "source /home/t8k/certbot_venv/bin/activate && \
certbot certonly --manual --preferred-challenges dns \
--config-dir /home/t8k/etc/letsencrypt \
-d anotherdomain.com -d *.anotherdomain.com"

Create separate server blocks for each domain with their respective certificates.


SSL configuration ensures secure connections to your TractStack site. For ongoing SSL management, see the Operations guide.