Try   HackMD

在 Debian Server 上使用 SSL 認證

tags: tutorials SSL raspberry pi apache2

使用工具

架伺服器工具

  • Raspberry Pi 4B
  • Apache2

SSL認證網站

選擇驗證方式

  1. 在輸入格中輸入你要被認證的網域後(如下圖),點擊右側 Create Free SSL Certificate

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  2. 接著會在下面跑出這張圖,點擊 Manual Verification

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  3. 接著繼續點擊 Manual Verify Domain

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

手動驗證網域

  1. 接著點擊下圖第一點的 Download File #1,這個會下載一個檔案。
    在自己的網頁伺服器資料夾( /var/www/html )中新增一個名為 .well-known 的資料夾,在這個資料夾中再新增一個名為 acme-challenge 的資料夾。
    再將剛剛下載的那個檔案放進 acme-challenge 中。

  2. 點擊下圖第五點的那行網址進行認證
    會出現一個分頁,上面寫著網址最後面的那條亂碼。
    代表驗證成功 !!

將驗證憑證放到Server上

  1. 驗證成功後即可點擊最下面的 Download SSL Certificate,會下載 SSL 相關檔案,將此檔案解壓縮後放進 Server 中。

  2. 前往 Server 上 Apache2 的設定資料夾

$ cd /etc/apache2/
  1. 新增一個名為ssl的資料夾,將SSL相關檔案放進去。
$ sudo mkdir ssl
  1. 修改 Apache2 SSL 的設定
$ vim.tiny sites-available/default-ssl.conf

修改下列地方
SSLCertificateFile /etc/apache2/ssl/certificate.crt
SSLCertificateKeyFile /etc/apache2/ssl/private.key
SSLCertificateChainFile /etc/apache2/ssl/ca_bundle.crt

  1. 啟用 Apache2 SSL site
$ sudo a2ensite default-ssl.conf
  1. 重啟 Apache2,這樣就有 SSL 認證啦~
$ sudo service apache2 restart

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →