哎?又剁手了 又买了新域名 但是这个真的很适合自己 zhou 周 su就当叔吧 反正差不多

自己喜欢就好没必要整什么com啊cn 然后奇怪的域名 不扯不扯 记录下申请Let’s Encrypt证书的过程吧

因为Let’s Encrypt有效期只有90天 到期重新申请?对我这种懒人来说是不存在的

好了好了开始折腾。

acme.sh 是个好东西可以申请证书然后自动续期 美滋滋哎

安装 acme.sh

安装很简单, 在vps输入一个命令就OK:

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

然后输入

acme.sh

卧槽?我明明安装了啊怎么会这样子

-bash: acme.sh: command not found

看他们的说明是自动部署环境啥啥啥的,可是我发现并没有

只能手动了

先看下.bashrc

vi ~/.bashrc

显示


# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
. "/root/.acme.sh/acme.sh.env"

哎?看不懂哎。。。算了还是直接来吧

cd .acme.sh

然后输入

./acme.sh --issue -d zhou.su -d *.zhou.su --dns \    #这两段分开输 中间的域名替换成自己的就可以了
--yes-I-know-dns-manual-mode-enough-go-ahead-please

然后去域名注册商哪儿添加俩txt 我的是dnspod

嗯这样就好了 然后输入下命令验证下就可以了

./acme.sh  --renew -d  zhou.su -d *.zhou.su \  #这里也是分开输入
 --yes-I-know-dns-manual-mode-enough-go-ahead-please

到这里证书就申请好了,就是三个月后怎样到时候再说吧。


现在是在nginx中配置下 然后就成功部署ssl了

server {
  listen 80;
  listen 443 ssl http2;
  server_name zhou.su www.zhou.su;
  access_log /data/wwwlogs/zhou.su_nginx.log combined;
  index index.php index.html index.htm default.php default.htm default.html;
  root /data/wwwroot/zhou.su;
  
  #SSL配置
    ssl_certificate    /hmoe/zhou/.acme.sh/zhou.su/fullchain.cer;
    ssl_certificate_key    /hmoe/zhou//.acme.sh/zhou.su/zhou.su.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
	ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    error_page 497  https://$host$request_uri;

	
  include /usr/local/nginx/conf/rewrite/wordpress.conf;

  location ~ [^/]\.php(/|$) {
    #fastcgi_pass remote_php_ip:9000;
    fastcgi_pass unix:/dev/shm/php-cgi.sock;
    fastcgi_index index.php;
    include fastcgi.conf;
  }

  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
    expires 30d;
    access_log off;
  }
  location ~ .*\.(js|css)?$ {
    expires 7d;
    access_log off;
  }
  location ~ /\.ht {
    deny all;
  }
}

最后输入

 service nginx force-reload

来重启nginx使ssl生效

完事 现在试下

123.zhou.su 

666.zhou.su

破非死!