Insights:How to Set Up SSL Certificates and HTTPS: A Step-by-Step Configuration Order
Step 0: Confirm Requirements
- Which domains to cover: bare domain, www, and subdomains.
- DV or OV required?
- Single-domain, multi-domain, or wildcard certificate?
- Does the server/CDN support automatic renewal?
- Change window and rollback plan.
Step 1: Choose a Certificate
| Scenario | Recommendation |
|---|---|
| Single site, one domain | DV single-domain |
| Bare domain + www | Multi-domain or issue separately |
| Multiple subdomains | Wildcard |
| B2B / international trade | OV as needed |
| Multiple brands | SAN multi-domain |
Step 2: Generate CSR and Private Key
openssl req -new -newkey rsa:2048 -nodes \
-keyout example.key \
-out example.csr \
-subj "/CN=example.com"
Note:
- Minimize private key permissions.
- Back up the private key.
- Do not copy the private key across multiple machines.
- Record which domain the CSR corresponds to.
Step 3: Verify Domain and Issue
- DNS verification: add the specified TXT record.
- File verification: place the specified file on your server.
- Organization validation: submit required documents per CA guidelines.
- After issuance, download the full certificate bundle.
Step 4: Install Certificate and Chain
- Server certificate.
- Intermediate certificate.
- Private key.
- Merge/configure as required by your server.
- Reload the service.
Verify:
openssl s_client -connect example.com:443 -servername example.com
Check that the certificate chain is complete and the domain matches.
Step 5: Redirect All Traffic to HTTPS
Nginx example:
server {
listen 80;
server_name example.com www.example.com;
return 301 https://$host$request_uri;
}
- Redirect every HTTP endpoint.
- Preserve paths and query parameters.
- Avoid redirect chains.
- Ensure the admin panel and API also support HTTPS.
Step 6: Handle Mixed Content
- Convert all images, CSS, and JS to HTTPS.
- Batch-replace old HTTP links in the database.
- Confirm third-party resources support HTTPS.
- Verify there are no mixed-content warnings in the browser console.
Step 7: Enable HSTS
Once the entire site is on HTTPS:
Strict-Transport-Security: max-age=31536000; includeSubDomains
- Start with a short
max-agefor observation. includeSubDomainsConfirm all subdomains are supported.preloadProceed with caution.
Step 8: Testing
- Browser lock icon.
- Online SSL checker.
- Multiple clients and networks.
- Mobile devices.
- API calls.
- Legacy URL redirects.
Step 9: Renewal & Monitoring
- Automatic renewal.
- Alerts 30 days before expiry.
- Reload after renewal.
- Keep old certificate for rollback.
- Log renewal records.
Common Failure Points
| Symptom | Cause |
|---|---|
| Browser does not trust | Incomplete chain / root certificate issue |
| 裸 domain errors | Certificate not covering the domain |
| Some pages still use HTTP | Redirects not fully applied |
| Lock icon shows gray | Mixed content |
| Suddenly inaccessible | Certificate expired |
Limitations
HTTPS configuration addresses transport encryption and identity verification, but not application-level vulnerabilities. Security headers, access controls, and input validation are still required after setup.
Related reading: