[精讚] [會員登入]
475

使用letsEncrypt替換docker容器內的nginx https憑證

using cerbot for nginx on oracle linux 9

分享此文連結 //n.sfs.tw/16227

分享連結 使用letsEncrypt替換docker容器內的nginx https憑證@外行中的外行
(文章歡迎轉載,務必尊重版權註明連結來源)
2023-09-07 16:35:58 最後編修
2023-09-07 16:35:28 By jung
 

由於https憑證到期,但新憑證尚未請購

只好先替換為免費的letsEncrypt憑證

但nginx放在docker容器中,據某大神說,這樣要取得letsEncrypt驗證很麻煩

由於時間緊迫,只好之後再來研究

先變通一下,在oracle linux 9上裝好nginx啟動後讓letsEncrypt驗證域名

dnf install nginx

重點是certbot要用nginx專用的

dnf install certbot python-certbot-nginx

啟動systemctl restart nginx

開始驗證,只取得憑證檔案

certbot certonly --nginx -d your.domain.name

成功的話,就會產生憑證檔案放在指定目錄

Successfully received certificate.

Certificate is saved at: /etc/letsencrypt/live/matsu.sso.edu.tw/fullchain.pem

Key is saved at:         /etc/letsencrypt/live/matsu.sso.edu.tw/privkey.pem

This certificate expires on 2023-12-06.

然後本機的nginx就可以停掉了

打開憑證來看,其實fullchain.pem就是server, uca, root三張放在一起

所以把nginx用的cer檔清空,再把fullchain.pem內容放進去

同理可證 privkey 就是 private.key

但內容比較短,不知道原因,可以用就對了

cat /dev/null > nginx.cer && cat fullchain.pem >> nginx.cer

重新啟動容器

docker restart nginx

 

 

END

你可能感興趣的文章

在IDEA從JDK8升級到JDK11遇到的奇怪問題 在IDEA遇到的JAVA11函式庫引入問題

intellij IDEA git設定說明 whenever using git push fuction in the intellij IDEA

使用letsEncrypt替換docker容器內的nginx https憑證 using cerbot for nginx on oracle linux 9

[NetBeans]如何從git下載專案改建為自己的專案 修改git專案

unknown issue after downgrade to intellij idea community version 使用社群版遇到的奇怪問題

how to make wicket web application runs under docker enviorment with correct encoding 在docker環境下,wicket web application 編碼錯誤的問題

我有話要說

>>

限制:留言最高字數1000字。 限制:未登入訪客,每則留言間隔需超過10分鐘,每日最多5則留言。

訪客留言

[無留言]

隨機好文

[網管心得]ssh keygen用法 ssh-copy-id

更新IDP程式以新增及修正本地管理帳號登入 add locallogin page and function with local authorized account

在新版谷歌協作平台嵌入edimax或lass空氣盒子讀取數值並視覺化 embeeded javascript to read and visualized lass json value on new google site

如何在ubuntu 18.04上設定一開機就啟動virtualbox某個vm a way to setup ubuntu18.04 for start vm on boot

更新程式環境到wildfly18+openjdk11-phase1: upgrade mongodb server 更新程式環境到wildfly18+openjdk11-phase1: upgrade mongodb server to version 3.6