为网站配置 letsencrypt ssl 证书 (for nginx)
Doveccl
本文距离上次更新已过去 0 天,部分内容可能已经过时,请注意甄别。

安装 Let’s Encrypt

  • Debian / Ubuntu
1
sudo apt-get install letsencrypt
  • Redhat / CentOS
1
2
sudo yum install epel-release
sudo yum install letsencrypt
  • Others (python)
1
sudo pip install letsencrypt

关闭 nginx & 获取证书

1
2
sudo service nginx stop
letsencrypt certonly --standalone -d your.domian -d another.domian

修改配置

开启 https

1
2
3
4
5
6
7
8
9
10
11
12
13
14
server {
listen 443;
listen [::]:443;
server_name your.domain;

ssl on;
ssl_certificate /etc/letsencrypt/live/your.domain/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/your.domain/privkey.pem;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_prefer_server_ciphers on;

# other config
}

开启重定向

1
2
3
4
5
6
server {
listen 80;
listen [::]:80;
server_name your.domain;
return 301 https://$server_name$request_uri;
}

开启 nginx 服务

1
sudo service nginx start
 评论
评论插件加载失败
正在加载评论插件
由 Hexo 驱动 & 主题 Keep
总字数 24.2k 访客数 访问量