Skip to content

Instantly share code, notes, and snippets.

@stefanJi
Created October 26, 2019 02:50
Show Gist options
  • Save stefanJi/3d2d591891f7bc6f210074b0613f4fe0 to your computer and use it in GitHub Desktop.
Save stefanJi/3d2d591891f7bc6f210074b0613f4fe0 to your computer and use it in GitHub Desktop.
为博客配置使用 acme 协议的 SSL 证书
acme.sh --issue -d blog.jiyang.site --webroot /home/jy/stefanji.github.io/
acme.sh --installcert -d blog.jiyang.site \
--key-file /home/jy/ssl/blog.jiyang.site.key \
--fullchain-file /home/jy/ssl/fullchain.cer
## nginx config
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name blog.jiyang.site;
root /home/jy/stefanji.github.io;
# SSL
ssl_certificate /home/jy/ssl/fullchain.cer;
ssl_certificate_key /home/jy/ssl/blog.jiyang.site.key;
# index.html fallback
location / {
try_files $uri $uri/ /index.html;
}
}
# HTTP redirect
server {
listen 80;
listen [::]:80;
server_name blog.jiyang.site;
return 301 https://blog.jiyang.site$request_uri;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment