用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