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

相关推荐
牧码岛6 分钟前
阿里云服务器新端口上线SOP(Windows+Nginx+HTTPS)
服务器·nginx·阿里云
钟良堂13 分钟前
Ubuntu 20.04 部署 ORB_SLAM3 完整流程与踩坑总结
linux·运维·ubuntu
北冥you鱼4 小时前
HTTPS 推送失败?改用 SSH 一键搞定
网络协议·https·ssh
xixingzhe215 小时前
nginx无网络升级
服务器·nginx
CZIDC17 小时前
华为服务器TS200-2280 V2 iBMC导入SSL证书后问题案例分析
服务器·https·ssl
牢姐与蒯18 小时前
Linux进程(四).进程优先级以及进程切换,进程调度
linux·运维·服务器·ubuntu
鱼很腾apoc21 小时前
【Linux】第13期 详解应用层协议HTTP+Cookie/Session+HTTPS
linux·服务器·c++·学习·http·https
奈斯先生Vector1 天前
从“能调用”到“可替换”:Coze 多模型 API 编排层设计指南
linux·运维·人工智能·ubuntu·平面·ios
味悲1 天前
HAProxy 负载均衡实战:从环境搭建到七层/四层/HTTPS 全解析
运维·https·负载均衡