SSL证书更换

Published on
42

__85.t01b675ee59073eb214.jpg

ssl证书又过期了

腾讯云免费SSL证书缩短至3个月有效期,之前是12个月。也就是说以后每三个月就必须换一次,不然以 https:1000px.fun 域名的方式访问就报错。很多浏览器会自动将 http请求升级为 https,所以,不得不换😭

image-ucge.png

顺便备份一下nginx配置

80端口,自动重定向为https。如果SSL证书过期,可先放开location注释。注释掉重定向部分即可:

    server {
         listen 80;
                 #请填写绑定证书的域名
         server_name 1000px.fun www.1000px.fun;
         return 301 https://$server_name$request_uri;
#         location /  {
#         proxy_set_header HOST $host;
#         proxy_set_header X-Forwarded-Proto $scheme;
#         proxy_set_header X-Real-IP $remote_addr;
#         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#         proxy_pass  http://ip:端口;
#         }
     }

443端口

 server {
        listen 443 ssl;
        server_name 1000px.fun www.1000px.fun;
        #填写证书文件的相对路径或绝对路径
        ssl_certificate 1000px.fun_bundle.crt;
        #填写私钥文件的相对路径或绝对路径
        ssl_certificate_key 1000px.fun.key;
        ssl_session_timeout 5m;
        #按照以下协议配置
        ssl_protocols TLSv1.2 TLSv1.3;
        #按照以下套件配置,配置加密套件,写法遵循 openssl 标准。
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
        ssl_prefer_server_ciphers on;
        location /  {
          proxy_set_header HOST $host;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://ip:端口;
         }
     }