1. 程式人生 > >阿里雲+Ubuntu+nginx+https的證書申請與配置

阿里雲+Ubuntu+nginx+https的證書申請與配置

1.【到阿里雲可以申請免費證書】

看這篇:看看大體流程

咦,阿里雲上免費的證書申請找不到了?看這篇:其實免費的證書在這裡

申請過程的補充看這裡:申請過程的補充

2.【下載特定伺服器證書,配置伺服器】

    ①在阿里雲上下載“證書for nginx”。解壓檔案上傳到伺服器,我這裡上傳到/usr/share/nginx下新建的cert目錄裡。

    ②下載證書的時候,會有一段提示的程式碼,把程式碼加到配置檔案中請注意改動的檔案是/etc/nginx/sites-available/default,而不是/etc/nginx/nginx.conf


server {
    listen 443;
    server_name abcdfg.com;
    ssl on;
    root html;
    index index.html index.htm;
    ssl_certificate   /usr/share/nginx/cert/214708106055285.pem;
    ssl_certificate_key  /usr/share/nginx/cert/214708106055285.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 / {
        root html;
        index index.html index.htm;
    }
} 

3.【重啟nginx】

service nginx restat