阿里雲免費版https配置


1.登錄阿里雲,找到ssl證書

點擊購買

 

找到Symantec,選擇免費版:

購買成功后,點擊申請,填寫信息:

提交后等待審核,審核通過后就可以下載了,根據自己的中間件選擇不同的證書:

 

證書下載成功后上傳服務器,然后就是配置,我用的是nginx  ,配置方法如下:

server
    {
        listen 443;
        #listen [::]:443;
        server_name xxx.xxx.com; 這里跟的是你的域名
ssl on;
      
        index index.html index.htm;
       ssl_certificate   cert/214451005000128.pem; 這里寫的是你證書的地址和名字
       ssl_certificate_key  cert/214451005000128.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;
   
        index index.html index.htm index.php default.html default.htm default.php;
        root  /xxx/xxx/xxx; 這里是你程序訪問路徑
location / {
try_files $uri $uri/ /index.php$is_args$query_string;
}
        include none.conf;
        #error_page   404   /404.html;
location ~ ^/public/.*.(php|php5)$
        {
            deny all;
        }
        location ~ [^/]\.php(/|$)
        {
            # comment try_files $uri =404; to enable pathinfo
            try_files $uri =404;
            fastcgi_pass  unix:/tmp/php-cgi.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
            #include pathinfo.conf;
        }
 
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }
 
        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }
 
        access_log  /xxx/xxx/xxx.log  access; #日志  自己配置
}

以上配置視個人情況而定,不要的可以刪掉,差的自己補一波就可以了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM