大网数据广告活动
服务器运维问答

How can I make SSL Lets Encrypt certificate auto renew on Ubuntu

· 52CE 我爱测

How can I make the certificate for vgo site to auto new every time so I don't have to renew it manual or it will auto renew itself? ssl_certificate /etc/letsencrypt/live/www.site.com/fullchain.pem; # managed by Certbot ssl_certif…

问题原文

原帖链接 · Crypto Coupons · CC BY-SA 4.0

How can I make the certificate for vgo site to auto new every time so I don't have to renew it manual or it will auto renew itself?

ssl_certificate /etc/letsencrypt/live/www.site.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.vsite.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot




add_header Strict-Transport-Security "max-age=31536000" always; # managed by Certbot


ssl_trusted_certificate /etc/letsencrypt/live/www.site.com/chain.pem; # managed by Certbot
ssl_stapling on; # managed by Certbot
ssl_stapling_verify on; # managed by Certbot

I have ubuntu, nginx btw and i am using letsencrypt

Edit: Like Gerald Schneider suggested having certbot installed on ubuntu auto renews by default how can I check this ?

root@ubuntu-s-1vcpu-1gb-amd-sfo3-01:~# certbot -v
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: site.com
2: www.site.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 

已采纳解答

原帖链接 · Gerald Schneider · CC BY-SA 4.0

If you installed certbot on Ubuntu as a regular package there is nothing you need to do, a systemd timer is installed automatically.

$ sudo apt install certbot python3-certbot-nginx
$ dpkg -L certbot |grep systemd
/lib/systemd/system/certbot.service
/lib/systemd/system/certbot.timer
$ cat /lib/systemd/system/certbot.timer
[Unit]
Description=Run certbot twice daily

[Timer]
OnCalendar=*-*-* 00,12:00:00
RandomizedDelaySec=43200
Persistent=true

[Install]
WantedBy=timers.target

When you use the --nginx argument to get a certificate certbot knows that nginx has to be reloaded after renewals and does so automatically.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2023-03-06)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。