Certificates are valid for ninety days and automatically renewed, where should this be configured?
The HTTPS certificate has a validity period of ninety days, which is not too long, but also not short enough to be ignored. The official recommendation is to run a renewal task every sixty days, and the cached authorization can be retained for up to thirty days after verification. According to this standard, automatic renewal should be a fixed step in the deployment process, located between 'after the certificate is issued and before the site service is reloaded', triggered by a scheduled task instead of manually handling it when the browser prompts that the certificate is about to expire. The basis for determining whether it is truly renewed is the actual expiration date of the online certificate, not whether there are any errors in the task log.
Why is the certificate only given for ninety days
The short validity period is a trade-off for security: the impact of key leakage is compressed to a few days, and the duration of mistakenly issued certificates is also short. The cost is that the site must treat renewal as a routine operation.For a content management system, this belongs to part of the deployment process, which is at the same level as choosing a server and configuring a domain name. The several deployment methods of AnQiCMS all fall into this category: one-click deployment with Baota panel and aaPanel, LNMP command deployment, Docker image deployment, the application listens to port 8001 by default, and the certificate and redirection are usually handled by the front-end Nginx, and the renewal task is also installed in the host machine's scheduled task.
How early should you start to renew, and how often should you run it
According to the public口径, set the rhythm to: trigger once every sixty days, and consider the thirty days before expiration as a safe margin. The task itself should be idempotent - if the certificate is early, exit directly, and initiate issuance only when it is about to expire. Two details are easy to overlook: first, the verification records have a cache retention period, and repeated applications within a short period of time may not always go through the complete domain name verification; second, the renewal of the certificate does not mean it takes effect, the new file must be loaded by the service process, otherwise the old certificate is still in use online.
Where should the renewal task be placed
Three common locations, sorted by controllability:
The panel layer is the most convenient. The Baota panel and aaPanel's certificate management come with an automatic renewal switch, which is executed by the panel's scheduled task after checking, and both renewal and reload are completed by the panel, suitable for single-site, standard directory structure scenarios.
The host layer is the most controllable. When deploying with commands or LNMP environments, write the renewal script into the root user's crontab, triggered once a day, the script internally judges the remaining days; put the reload at the end of the same script, and ensure that the reload fails and returns a non-zero value, which is convenient for external monitoring to capture.
The container layer is the easiest to fall into pitfalls. When deploying Docker, the certificate file is in the image or mounted volume, if the renewal task runs inside the container, the task and results will be lost when the container is rebuilt. Keeping the task on the host machine, using a volume mounted to share the certificate directory, and reloading through the host layer's proxy service is a more stable combination.
The redirection to check after the certificate is replaced
The old address is still there after the certificate is replaced. Check three places:
- The redirection from http to https must be unified according to the rules. AnQiCMS backend has a 301 redirect management, which can set URL redirection rules to unify the combination of protocol and bare domain to a standardized address, avoiding the same content appearing at four entrances.
- Absolute addresses in the page. Old protocol addresses hardcoded in historical articles or templates can cause mixed content, with browsers blocking unsafe resources, resulting in style disorder or images not displaying. The site-wide replacement tool is suitable for such batch replacements, and it is particularly careful to limit the scope before replacement, and be extra careful when modifying navigation and hard-coded addresses in single-page.
- robots and the address protocol registered in the site map. The protocol also writes the old side, and the side captured is the one that needs to be redirected.
How to confirm that it has really been renewed?
Three steps, from top to bottom in order:
Check the online certificate for the first step. Open the site in the browser to view the certificate details, or use the command on the server to query the expiration date of the peer certificate, and confirm that the date has been extended.Second step, view the task history. The execution record of planned tasks should retain both success and failure results, repeated failures should be detected, AnQiCMS supports email reminders, and such notifications can be sent to the maintainer.Check the rollback capability in the third step. Certificate replacement is an operation that affects the access to the entire site, so it is necessary to leave a backup before the operation. The backup and recovery of AnQiCMS covers data and static files, so if there is a problem, you can roll back according to the backup instead of looking for the certificate file temporarily.
Common questions
Will it be a problem to run the renewal before the certificate expires?The task should be written as idempotent: if there are enough days left, skip directly. Frequent unnecessary applications may trigger rate limiting, so the judgment should be made before the application.
Should I be nervous if the automatic renewal fails once?Check the remaining amount. Under the 60-day rhythm, there is a 30-year safety margin, there is time to make up for a single failure, but continuous failure and no one knows is the risk, so the notification link needs to be independently verified once.
Can the certificate be replaced without redirecting?It can be accessed in the short term, but the old protocol address is still accessible. Two versions will exist in the search results, and the changes will be greater when unifying the mouth later.
Should the renewal task be installed in the container for Docker deployment?Not recommended. The container is a disposable environment that can be rebuilt at any time. The renewal task and execution status should remain on the host layer, and the certificate directory should be shared through a mounted volume.