oneinstack 安装 https-certbot
免费https? 官方安装教程:https://certbot.eff.org/#centos6-nginx (以下是说明安装时遇到的);
- 下载并修改文件权限
1wget https:
//dl
.eff.org
/certbot-auto
&&
chmod
a+x certbot-auto
- 执行:
- ./certbot-auto --nginx certonly 或是 ./certbot-auto --nginx
报错:xx包........出错;请 yum update 更新一下;
报错:一般情况oneinstack 把nginx 没有安装在 /etc 目录:1234567891011WARNING: unable to check
for
updates.
Saving debug log to
/var/log/letsencrypt/letsencrypt
.log
Error
while
running nginx -c
/etc/nginx/nginx
.conf -t.
nginx: [emerg]
open
()
"/etc/nginx/mime.types"
failed (2: No such
file
or directory)
in
/etc/nginx/nginx
.conf:15
nginx: configuration
file
/etc/nginx/nginx
.conf
test
failed
Could not choose appropriate plugin: The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError(
'Error while running nginx -c /etc/nginx/nginx.conf -t.\n\nnginx: [emerg] open() "/etc/nginx/mime.types" failed (2: No such file or directory) in /etc/nginx/nginx.conf:15\nnginx: configuration file /etc/nginx/nginx.conf test failed\n'
,)
The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError(
'Error while running nginx -c /etc/nginx/nginx.conf -t.\n\nnginx: [emerg] open() "/etc/nginx/mime.types" failed (2: No such file or directory) in /etc/nginx/nginx.conf:15\nnginx: configuration file /etc/nginx/nginx.conf test failed\n'
,)
解决方案:执行:
1/certbot-auto
--nginx --nginx-server-root=
/usr/local/nginx/conf
-
选择 7; 需要添加HTTPS的域名 -
选择2;全部使用HTTPS -
- ./certbot-auto --nginx certonly 或是 ./certbot-auto --nginx
- 完成;此时访问域名,便是https请求方式了。
- 默认免费证书时间是有限的。需要更新达到续签; (/root/certbot-auto 为本人 certbot 安装目录)
- 手动续签
1/root/certbot-auto
renew
- 自动续签
执行:1crontab
-e
写入:每天零点到十二点更新一次;
10 0,12 * * * python -c
'import random; import time; time.sleep(random.random() * 3600)'
&&
/root/certbot-auto
renew
也可以:30 2 * */2 * certbot renew –pre-hook “service nginx stop” –post-hook “service nginx start” —— 每隔两个月凌晨2:30更新:
- 续签完成:并显示过期时间 crontab -l 可查看任务详情;
- 手动续签
- -结束
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南