docs: SOP 新增步驟 9 — 更新 NPM 資料庫到期日顯示

Custom Certificate 無法透過 UI 編輯,需用 Python 直接改 SQLite

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-09 10:37:01 +08:00
parent bbea2fe77a
commit 1e7ed758de

View File

@@ -108,22 +108,30 @@ ssh hospital_web "echo | openssl s_client -connect localhost:443 \
| grep 'Verify return code'" | grep 'Verify return code'"
``` ```
預期:`Verify return code: 0 (ok)`
> 注意GCA 憑證的根 CAGRCA G3不在 Linux 預設信任庫, > 注意GCA 憑證的根 CAGRCA G3不在 Linux 預設信任庫,
> 伺服器端會顯示 `Verify return code: 20`,這是正常的。 > 伺服器端會顯示 `Verify return code: 20`,這是正常的。
> 瀏覽器端通常可正常驗證。 > 瀏覽器端通常可正常驗證。
--- ### 步驟 9更新 NPM 資料庫顯示
## 替代方案:透過 NPM 管理後台 直接替換檔案部署時NPM 後台顯示的到期日不會自動更新Custom Certificate 無法透過 UI 編輯)。
需手動更新資料庫:
1. `ssh hospital_web`(自動建立 port forwarding ```bash
2. 瀏覽器開啟 `http://localhost:8181` ssh hospital_web 'sudo docker exec nginxproxymanager /opt/certbot/bin/python3 -c "
3. SSL Certificates → Add SSL Certificate → Custom import sqlite3, datetime
4. 貼上 `fullchain.pem` 內容Certificate conn = sqlite3.connect(\"/data/database.sqlite\")
5. 貼上 `privkey.pem` 內容Certificate Key c = conn.cursor()
6. 儲存後套用至對應的 Proxy Host 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 後台頁面即可看到正確的到期日。
--- ---