Bitwarden 是一款 100% 開源的跨平台密碼管理服務,你可以將網路憑證、私鑰、證書、照片之類的敏感文件加密儲存於服務中。如果你不希望將資料儲存於 Bitwarden 官方伺服器,你可以經由簡單的步驟架設自己的 Bitwarden 服務平台。
系統需求
- Windows 10 專業版作業系統
- 可使用 80 與 443 端口的網路
- 一個網域
開啟 Hyper-V 虛擬機服務
進入 控制台 -> 程式集 -> 程式和功能 -> 開啟或關閉 Windows 功能,將 Hyper-V 與他的子項目全部勾選,並按下確定。

安裝 Docker Desktop
前往 Docker Hub 註冊一支帳號,並安裝 Docker Desktop for Windows。
安裝完成後開啟 Docker Desktop,登入你的 Docker ID。
登入後,從右下角的 Docker 通知圖示上按下滑鼠右鍵 -> Settings,切換到 Shared Drives,將要放置 Bitwarden 的硬碟勾選並 Apply。
安裝 Bitwarden 伺服器
接下來開始安裝與初始設置……
新增一個資料夾,在資料夾中用系統管理員權限開啟 Windows PowerShell,輸入以下指令來進行執行原則變更。
Set-ExecutionPolicy RemoteSigned
選項請選擇 A 全部皆是。
下載安裝腳本:
Invoke-RestMethod -OutFile bitwarden.ps1 ` -Uri https://raw.githubusercontent.com/bitwarden/server/master/scripts/bitwarden.ps1
啟動安裝腳本。
.\bitwarden.ps1 -install
輸入必需的安裝資訊:
Enter the domain name for your Bitwarden instance (ex. bitwarden.example.com): 輸入你的網域名稱
我實際安裝的時候發現這個伺服器安裝包在 Windows 系統中會有問題,在申請證書時會出錯,最後造成 Nginx 無法運作。所以在這裡我決定不使用它的自動證書申請,而是手動指派。
Do you want to use Let’s Encrypt to generate a free SSL certificate (y/n): N
Enter your installation id: 前往 Hosting Installation Id & Key 取得授權 ID
Enter your installation key: 前往 Hosting Installation Id & Key 取得授權 Key
Do you have a SSL certificate to use? (y/n): Y
Is this a trusted SSL certificate (requires ca.crt, see docs)? (y/n): Y
手動設置 SSL 證書
前往 SSL For Free 下載免費的 Let’s Encrypt 證書,建議使用 DNS 驗證。
下載後先解壓縮,將 ca_bundle.crt 改名為 ca.crt,並複製 ca.crt 中的字串貼上到 certificate.crt 檔案內的下方。(用文字編輯器開啟)
最後將 ca.crt、certificate.crt、private.key 這三個檔案移動至 bwdata\ssl\網域名稱 目錄下。
設置 Port Forwarding 端口轉發
如果你的伺服器是自己家裡的,那通常需要設置路由器的端口轉發:新增 80 Port 與 443 Port 兩條設定。

最終連線測試
啟動伺服器。
.\bitwarden.ps1 -start
成功!
