使用acme.sh全自動生成ssl證書


用nginx+域名配置一個80端口的http服務

server {
server_name helloworld.com;
listen 80;
location / {
add_header Content-Type text/plain;
return 200 'hello world';
}
}

安裝

curl https://get.acme.sh | sh

生成證書

#!/bin/sh
/root/.acme.sh/acme.sh --issue -d $1 --nginx --debug

復制證書到特定的位置

#!/bin/sh
alias acme.sh='/root/.acme.sh/acme.sh'
domain=$1

mkdir -p /usr/share/nginx/ssl/$domain

/root/.acme.sh/acme.sh --installcert -d $domain \
--key-file /usr/share/nginx/ssl/$domain/key.pem \
--fullchain-file /usr/share/nginx/ssl/$domain/cert.pem \
--reloadcmd "service nginx force-reload"

修改nginx配置,支持ssl


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM