Version v3.7.0 of the documentation is no longer actively maintained. The site that you are currently viewing is an archived snapshot. For up-to-date documentation, see the latest version.
SSL Certs
Pigsty comes with Certbot pre-installed on the Infra node, enabling you to obtain free Let’s Encrypt HTTPS certificates for Nginx servers and public domains.
Prerequisites
Before obtaining Let’s Encrypt certificates, ensure you have:
- A public domain name
- DNS records pointing to your server’s public IP
- Nginx properly configured with your domains
Step 1: Determine Which Domains Need Certificates
First, identify which upstream services require public certificates by configuring domains in your infra_portal:
Step 2: Point Domains to Your Server
Configure DNS A records to point all your domains to your server’s public IP address:
Verify that your domains are properly pointing to your server:
Step 3: Request Certificates with Certbot
Use Certbot to request Let’s Encrypt certificates for your domains:
Interactive Method (First Time)
During the first run, you’ll be prompted to:
- Provide an email address for Let’s Encrypt account registration
- Agree to the Terms of Service
- Choose whether to share your email with the Electronic Frontier Foundation
Non-Interactive Method
For automated deployments, use the non-interactive mode:
Example for multiple domains:
Step 4: Update Nginx Configuration
After successfully obtaining certificates, update your infra_portal configuration to use them by adding the certbot: true parameter:
Then regenerate the Nginx configuration and restart the service:
Step 5: Configure Certificate Renewal
Let’s Encrypt certificates expire every 90 days. Set up automatic renewal to ensure continuous HTTPS coverage:
Test Renewal (Dry Run)
Before setting up automatic renewal, test the process:
Manual Renewal
To manually renew all certificates:
To renew a specific certificate:
Automatic Renewal
Set up a monthly cron job for automatic renewal:
Alternatively, use a systemd timer if available:
Certificate Management Commands
Here are useful Certbot commands for managing your certificates:
Troubleshooting
Common Issues
- Domain not accessible: Ensure DNS records are properly configured and propagated
- Port 80 blocked: Let’s Encrypt requires port 80 for domain validation
- Rate limits: Let’s Encrypt has rate limits; avoid requesting too many certificates quickly
- Firewall issues: Ensure ports 80 and 443 are open in your firewall
Verification Commands
Best Practices
- Use wildcard certificates for multiple subdomains when appropriate
- Monitor certificate expiration with automated alerts
- Test renewal process regularly with dry runs
- Keep backups of your certificate files
- Use staging environment for testing before production deployment
- Set up monitoring for certificate expiration dates
- Document your domain configuration for team reference
Security Considerations
- Protect private keys: Ensure certificate private keys have restricted permissions
- Use strong SSL configuration: Configure Nginx with modern SSL settings
- Enable HTTP to HTTPS redirection: Force secure connections
- Implement HSTS: Add HTTP Strict Transport Security headers
- Regular security audits: Test your SSL configuration with tools like SSL Labs