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证书-腾讯云开发者社区-腾讯云

相关推荐
雨落Liy11 小时前
Nginx 从入门到进阶:反向代理、负载均衡与高性能实战指南
运维·nginx·负载均衡
Yyyy48212 小时前
Nginx负载均衡集群实验步骤
运维·nginx·负载均衡
绿箭柠檬茶12 小时前
Ubuntu 服务器配置转发网络访问
服务器·网络·ubuntu
风_峰12 小时前
Ubuntu Linux SD卡分区操作
嵌入式硬件·ubuntu·fpga开发
太空的旅行者18 小时前
告别双系统——WSL2+UBUNTU在WIN上畅游LINUX
linux·运维·ubuntu
ftpeak19 小时前
从零开始使用 axum-server 构建 HTTP/HTTPS 服务
网络·http·https·rust·web·web app
人工智能训练师20 小时前
Ubuntu22.04如何安装新版本的Node.js和npm
linux·运维·前端·人工智能·ubuntu·npm·node.js
qq_264220891 天前
Nginx优化与 SSL/TLS配置
运维·nginx
00后程序员张1 天前
详细解析苹果iOS应用上架到App Store的完整步骤与指南
android·ios·小程序·https·uni-app·iphone·webview
matlab的学徒1 天前
Web与Nginx网站服务(改)
linux·运维·前端·nginx·tomcat