From 1e7ed758de63fdecb7a7480c731e443d88072fee Mon Sep 17 00:00:00 2001 From: Timmy Date: Thu, 9 Apr 2026 10:37:01 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20SOP=20=E6=96=B0=E5=A2=9E=E6=AD=A5?= =?UTF-8?q?=E9=A9=9F=209=20=E2=80=94=20=E6=9B=B4=E6=96=B0=20NPM=20?= =?UTF-8?q?=E8=B3=87=E6=96=99=E5=BA=AB=E5=88=B0=E6=9C=9F=E6=97=A5=E9=A1=AF?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Custom Certificate 無法透過 UI 編輯,需用 Python 直接改 SQLite Co-Authored-By: Claude Opus 4.6 (1M context) --- ssl_deploy_guide.md | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/ssl_deploy_guide.md b/ssl_deploy_guide.md index 09b0403..88dc5e7 100644 --- a/ssl_deploy_guide.md +++ b/ssl_deploy_guide.md @@ -108,22 +108,30 @@ ssh hospital_web "echo | openssl s_client -connect localhost:443 \ | grep 'Verify return code'" ``` -預期:`Verify return code: 0 (ok)` - > 注意:GCA 憑證的根 CA(GRCA G3)不在 Linux 預設信任庫, > 伺服器端會顯示 `Verify return code: 20`,這是正常的。 > 瀏覽器端通常可正常驗證。 ---- +### 步驟 9:更新 NPM 資料庫顯示 -## 替代方案:透過 NPM 管理後台 +直接替換檔案部署時,NPM 後台顯示的到期日不會自動更新(Custom Certificate 無法透過 UI 編輯)。 +需手動更新資料庫: -1. `ssh hospital_web`(自動建立 port forwarding) -2. 瀏覽器開啟 `http://localhost:8181` -3. SSL Certificates → Add SSL Certificate → Custom -4. 貼上 `fullchain.pem` 內容(Certificate) -5. 貼上 `privkey.pem` 內容(Certificate Key) -6. 儲存後套用至對應的 Proxy Host +```bash +ssh hospital_web 'sudo docker exec nginxproxymanager /opt/certbot/bin/python3 -c " +import sqlite3, datetime +conn = sqlite3.connect(\"/data/database.sqlite\") +c = conn.cursor() +now = datetime.datetime.now().strftime(\"%Y-%m-%d %H:%M:%S\") +# 將到期日改為新憑證的到期日 +c.execute(\"UPDATE certificate SET expires_on=?, modified_on=? WHERE id=1\", (\"2028-04-01 00:54:36\", now)) +conn.commit() +print(\"Updated. Rows:\", c.rowcount) +conn.close() +"' +``` + +更新後重新整理 NPM 後台頁面即可看到正確的到期日。 ---