nginx 配置阿里云免费ssl证书

时间:2024-03-29 20:54:20

1:阿里云购买免费ssl证书一年

nginx 配置阿里云免费ssl证书

2:下载证书选择nginx 类型,上传到服务器

3:配置nginx

server {
        listen 443;
        server_name www.ckcxe.top;
        ssl on;
        ssl_certificate  /alidata/ssl/xxxxx.pem;//阿里云获取的ssl证书 pem文件
        ssl_certificate_key /alidata/ssl/xxxxx.key;//阿里云获取的ssl证书  key文件
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        location / {
                proxy_set_header   X-Forwarded-Proto http;
                proxy_set_header   X-Real-IP $remote_addr;
                proxy_set_header   Host      $http_host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass         http://127.0.0.1:8087;
                proxy_connect_timeout 1800s;
                proxy_send_timeout 1800s;
                proxy_read_timeout 1800s;
        }
   }

4:重启nginx 搞定