Ubuntu nginx let‘s encrypt免费 https 设置

1.安装配置证书

apt-get update

apt-get -y install certbot

apt-get -y install python3-certbot-nginx

certbot --nginx

2.注意事项

1.保证服务器可域名访问,certbot需要验证 txt 记录。

2.同时要保证nginx 已配置 80端口的域名,否则提示

Could not automatically find a matching server block for secure.o3i.international. Set the server_name directive to use the Nginx installer.

server { listen 80;

server_name o3i.international;

access_log logs/ o3i.international.access.log main; r

oot /var/www/ o3i.international/htdocs; }

3.certbot会自动修改 nginx 的配置文件,原来 80 端口不能被访问了,443 端口可访问了。

80 会跳 443,但是nginx如果是 代理接口,要配置两个 server 分别占用 80,443。保留 80

4.自动续期:

sudo certbot renew --dry-run

如果测试成功,Certbot 会自动配置系统定期运行证书续期。通常情况下,Certbot 会自动将续期命令添加到系统的任务调度器中,确保证书在过期前得到更新。

5.阿里云服务器要开启 443 端口

参考文档

使用Certbot工具来申请和管理Let's Encrypt证书-腾讯云开发者社区-腾讯云

相关推荐
老兵发新帖10 小时前
Ubuntu 上安装 Conda
linux·ubuntu·conda
fxshy12 小时前
ai聊天流式响应,阻塞式和流式响应 nginx遇到的坑
运维·javascript·nginx
foo1st15 小时前
Tomcat Web应用(Ubuntu 18.04.6 LTS)部署笔记
ubuntu·tomcat
cosX+sinY17 小时前
ubuntu 20.04 编译运行lio-sam,并保存为pcd
linux·ubuntu·机器人
FREEDOM_X19 小时前
ubuntu20.04 远程桌面Xrdp方式
ubuntu·vmware
꧁坚持很酷꧂20 小时前
配置Ubuntu18.04中的Qt Creator为中文(图文详解)
开发语言·qt·ubuntu
Sapphire~20 小时前
Linux-06 ubuntu 系统截图软件使用简单记录
linux·运维·ubuntu
biter008821 小时前
ubuntu(28):ubuntu系统多版本conda和多版本cuda共存
linux·人工智能·ubuntu·conda
花千树-01021 小时前
使用 Frp 同时实现 HTTP 和 HTTPS 内网穿透
网络协议·http·https
Hello.Reader1 天前
在 Ubuntu 环境为 Elasticsearch 引入 `icu_tokenizer
ubuntu·elasticsearch·jenkins