設置HTTPS

CanvasLMS如何設置HTTPS

設置HTTPS 的方法有兩種:

學校/公司憑證

使用已購買的SSL 憑證,操作步驟如下:
將憑證檔案上傳到憑證文件目錄
修改 Web Server conf 設定,以 Apache 為例:
SSLEngine on
SSLCertificateFile "/opt/canvas/canvaslms/conf/certs/server.crt"
SSLCertificateKeyFile "/opt/canvas/canvaslms/conf/certs/server.key"
/opt/canvas/canvaslms 替換成你的 canvas 目錄.
server.crt 及 server.key 分別是公鑰及私鑰.
重啟 WebServer Apache

Let's Encrypt 免費憑證
使用Let's Encrypt 免費證書生成工具,操作步驟如下:
cd /opt/canvas/canvaslms
sudo letsencrypt/scripts/gererate-certificate.sh -m YOUReMAIL -d CANVAS-Domain 
設定完導向後,記得 WebServer.

Canvas 導向 HTTPS

前面步驟設定 HTTPS 後,並不會讓使用者自動用 https 瀏覽你的課程;必須在 canvas 的 web server 設定中加入以下內容:
<VirtualHost *:80>
    ServerName test.canvaslms.com.tw
    ServerAlias test.canvaslms.com.tw
    DocumentRoot "/opt/canvas/canvaslms/public"
</VirtualHost>

<VirtalHost *:443>
    ServerName test.canvaslms.com.tw
    ServerAlias test.canvaslms.com.tw
    DocumentRoot "/opt/canvas/canvaslms/public"
    SSLEngine on
    SSLCertificateFile "/opt/canvas/canvaslms/conf/certs/server.crt"
    SSLCertificateKeyFile "/opt/canvas/canvaslms/conf/certs/server.key"

    RewriteEngine On
    RewriteCond %{SERVER_PORT} !^443$
    RewriteCond %{REQUEST_URI} !^/tz.php
    RewriteRuld (.*) https://%{SERVER_NAME}/$1 [R]
</VirtualHost>
done.


Comments