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

相关推荐
2501_915106321 小时前
TraceEagle 代理抓包教程 本机和手机的 HTTPS 抓包方法
网络协议·计算机网络·网络安全·ios·adb·https·udp
yangshun_cug5 小时前
Windows 11 的 WSL2 Ubuntu 22.04 安装 Seismic Unix 44R28 完整教程
windows·ubuntu·seismic unix
国服第二切图仔7 小时前
05-构建与特性开关
linux·服务器·ubuntu
FREEDOM_X7 小时前
嵌入式——定时器工作原理
linux·c语言·单片机·嵌入式硬件·ubuntu
Thecozzy7 小时前
Skill和MCP和Subagent 的选择
linux·人工智能·ubuntu
白驹过隙不负青春9 小时前
OpenResty 1.29.2.5 部署 + Nginx平滑升级运维文档
nginx·openresty
TlSfoward9 小时前
TLSFOWARD抓包工具 TLS指纹
网络协议·http·百度·https
国服第二切图仔10 小时前
002-Claude Code 项目解读:入口与启动流程
linux·git·ubuntu
Cry丶11 小时前
一次 FTP 上传引发 504 Gateway Timeout 的排查复盘
java·nginx·ftp·openresty·被动模式·504 gateway·生产问题排查
一勺菠萝丶1 天前
生产环境平滑升级实战-Nginx维护页数据库迁移与安全回滚
数据库·nginx·安全