极简部署linux免费ssl证书Let‘s Encrypt,自动续签,nginx/apache都可以,域名指向服务器即可,无需项目

1、拉取最新的代码

powershell 复制代码
git clone  https://gitee.com/neilpang/acme.sh.git

2、进入目录

powershell 复制代码
cd  acme.sh

3、安装

powershell 复制代码
./acme.sh  --install  -m  xxxx@qq.com 

xxxx@qq.com 切换自己邮箱

nginx 版本

4、 下载ssl证书

powershell 复制代码
./acme.sh  --issue  -d admin-beta.xxx.com  --nginx /www/server/nginx/conf/nginx.conf

admin-beta.xxx.com 替换为自己的域名, /www/server/nginx/conf/nginx.conf 替换为 本地的nginx配置文件的路径

5、安装ssl证书

nginx 复制代码
 ssl_certificate    /www/server/panel/vhost/cert/admin-beta.xxx.com/fullchain.pem;
 ssl_certificate_key    /www/server/panel/vhost/cert/admin-beta.xxx.com/privkey.pem;
powershell 复制代码
./acme.sh --install-cert -d admin-beta.xxx.com --key-file /www/server/panel/vhost/cert/admin-beta.xxx.com/privkey.pem --fullchain-file /www/server/panel/vhost/cert/admin-beta.xxx.com/fullchain.pem --reloadcmd "service nginx reload" 

将 service nginx reload 替换 自己nginx的重启命令

apache 版本

4、 下载ssl证书

powershell 复制代码
./acme.sh  --issue  -d admin-beta.xxx.com  --apache 

报错 可以设置

powershell 复制代码
ln -s /usr/local/apache/bin/apachectl /usr/bin/apachectl

5、安装ssl证书

apache 复制代码
SSLCertificateFile /etc/ssl/admin-beta.xxx.com/admin-beta.xxx.com.crt
SSLCertificateKeyFile /etc/ssl/admin-beta.xxx.com/admin-beta.xxx.com.key
SSLCertificateChainFile /etc/ssl/admin-beta.xxx.com /root_bundle.crt
powershell 复制代码
./acme.sh --install-cert -d admin-beta.xxx.com   --cert-file      /etc/ssl/admin-beta.xxx.com/admin-beta.xxx.com.crt   --key-file       /etc/ssl/admin-beta.xxx.com/admin-beta.xxx.com.key   --fullchain-file /etc/ssl/admin-beta.xxx.com /root_bundle.crt  --reloadcmd     "service httpd graceful" 

将 service httpd graceful 替换为 自己apache的重启命令

6、启动定时任务

powershell 复制代码
/root/.acme.sh/acme.sh  --cron  --home  /root/.acme.sh/

7、自动更新acme

powershell 复制代码
./acme.sh --upgrade --auto-upgrade
相关推荐
Yana.nice3 小时前
Linux 只保留 30 天内日志(find命令删除日志文件)
linux·运维·chrome
DFT计算杂谈6 小时前
无 Root 权限在 Tesla K80 零门槛部署 DeepSeek 大模型
linux·服务器·网络·数据库·机器学习
Zhang~Ling8 小时前
从 fopen 到 struct file:从零开始拆解 Linux 文件 I/O
linux·运维·服务器
DeeplyMind8 小时前
Linux 深入 per-VMA lock:Linux 缺页路径如何摆脱 mmap_lock
linux·per-vma lock
爱写代码的森8 小时前
蒙三方库 | harmony-utils之FileUtil文件重命名与属性查询详解
linux·运维·服务器·华为·harmonyos·鸿蒙·huawei
郝亚军9 小时前
使用Vue 3和Nginx打包和部署Vue.js项目的一般步骤
前端·vue.js·nginx
XMAIPC_Robot9 小时前
软硬协同实时控制|RK3588业务调度+FPGA硬件时序,ethercat实现半导体设备微秒级响应(125us)
linux·arm开发·人工智能·fpga开发
重生的黑客9 小时前
Linux 进程优先级、切换与调度:从孤儿进程到 O(1) 调度模型
linux·运维·服务器·进程优先级·nice
骑上单车去旅行11 小时前
MD5校验对比脚本
linux·服务器·windows