Sub topic 7
Testing Safely with Staging and Respecting Rate Limits
Assume you can use a Linux shell and sudo, nginx is installed, your domain points to this server, and ports 80 and 443 are reachable. You should test certificate requests before using the production Let's Encrypt service.
Why the Staging Environment Matters
Let's Encrypt provides a staging environment that behaves like production but issues certificates that browsers do not trust. Staging certificates are useful for checking:
- DNS records and server reachability
- HTTP-01 challenge handling
- Certbot options and domain names
- nginx configuration and file permissions
- Renewal and deployment scripts
The staging service has separate, more relaxed limits. A staging certificate does not make a public website secure for normal visitors. Use it only for testing.
Understanding Rate Limits
Rate limits prevent abuse and protect the certificate service. They apply to production requests and can affect repeated failed validations, duplicate certificates, and account activity. Exact limits can change, so check the current Let's Encrypt rate-limit documentation before automation.
Common causes of unnecessary requests include:
- Re-running a production command after every small configuration change
- Requesting separate certificates for the same names
- Including incorrect or unused domain names
- Creating many temporary accounts or server instances
- Testing renewal by repeatedly requesting new certificates
A failed staging request usually does not consume the corresponding production certificate limit. However, staging has its own limits, so it is still possible to overuse it.
Test with Certbot
Install Certbot and its nginx plugin if they are not already installed:
sudo apt update
sudo apt install certbot python3-certbot-nginx
certbot --versionRequest a staging certificate with the same names you plan to use in production:
sudo certbot certonly --nginx --staging \
-d example.com -d www.example.comThe certonly option obtains certificate files but does not change nginx's site configuration. The --nginx plugin temporarily answers the HTTP-01 challenge through nginx. Replace the example names with names that resolve to your server.
After a successful request, inspect the result:
sudo certbot certificates
sudo ls -l /etc/letsencrypt/live/example.com/The staging certificate should contain the requested names, but clients will report that its issuer is not trusted. That result is expected.
When DNS, firewall rules, nginx behavior, and your deployment process work correctly, request the production certificate without --staging:
sudo certbot certonly --nginx \
-d example.com -d www.example.comKeep the exact domain set stable. If you later add a name, first test the complete set in staging again.
Test Renewal Without Issuing a New Certificate
Certbot's dry run checks the renewal process against the staging service:
sudo certbot renew --dry-runThis tests renewal configuration and hooks without replacing a live production certificate. Run it after configuring renewal hooks or changing nginx settings.
Exercise
You have corrected an HTTP-01 failure and want to verify the fix without risking a production rate limit. Which command should you run first?
Show answer
Run sudo certbot certonly --nginx --staging -d example.com with every required domain included. Request the production certificate only after staging validation succeeds.