Let’s Encrypt in Nginx

更新於 發佈於 閱讀時間約 4 分鐘

Recently, I wanted to put my new web project online. I need to change it from http server to https server. And I totally forgot how I obtained the certification from let’s encrypt before.

I’m sure that I would forget it again after a few months, so let’s take note of it.

Installation

We need to use certbot to obtain and manage the certification. The detailed instruction is at https://certbot.eff.org/instructions. You can choose the software for web deployment and the OS you used on this web page to see the instruction.

raw-image

Since I use Nginx on my mac mini as the server for web deployment, I would only talk about it in this article.

We need to use homebrew to install certbot.

$ brew install certbot

Obtain certification

I assume you already set up the http server for your project. If you need the detail of the basic settings of Nginx, you can see the article I wrote before. https://medium.com/@xdxxxx4713/basic-settings-of-nginx-aeace532534f

$ sudo certbot run
raw-image

type 2 to use Nginx

raw-image

choose the website you want to activate https

And certbot would auto modify your Nginx config, which is pretty annoying. Usually, I would set my config as follows.

renew

To manually renew, just type

$ sudo certbot renew

Also, there's an instruction to set up automatic renewal on the above certbot instruction website.

Since I don’t know this method before, I wrote a python script for auto renew.

It would renew the certifications every 10 days.

留言
avatar-img
留言分享你的想法!
avatar-img
張哲嘉的沙龍
9會員
49內容數
比起詳細教學單一技能,網路上或者市面上整合多項技能的教學相對少很多,但要真的完成一項專案往往不是只靠一項技能便能做到。 而且教科書式的完整教學也比較枯燥乏味,因此我想以自身的經驗為例,以全端開發各項技能中最常用到的部分進行講解,讓讀者能夠快速上手掌握全端技能。
張哲嘉的沙龍的其他內容
2023/01/09
最近想把我的 Switch OLED 帶出門,在挑什麼 Switch 攜帶包比較好,看很多人都推薦 tomtoc,感覺評價挺不錯的,最後決定入手 tomtoc 的玩家首選旅行包 以 Switch OLED 來說有三種選擇...... https://zjzhang.org/post/nintendo
2023/01/09
最近想把我的 Switch OLED 帶出門,在挑什麼 Switch 攜帶包比較好,看很多人都推薦 tomtoc,感覺評價挺不錯的,最後決定入手 tomtoc 的玩家首選旅行包 以 Switch OLED 來說有三種選擇...... https://zjzhang.org/post/nintendo
2022/12/14
Cache categories There are two kinds of cache, one is the read-only cache, and the other one is the read-and-write cache.
2022/12/14
Cache categories There are two kinds of cache, one is the read-only cache, and the other one is the read-and-write cache.
2022/10/13
最近在把 Tailwind CSS 加入我的技能樹中,其實像這種 Bootstrap, Tailwind CSS 都是很基本前端需要掌握的 CSS 相關工具 但是我其實對美工比較沒那麼大的興趣,我對功能、效能、安全比較感興趣,所以後端、架站、DevOps、一些安全防護玩了一圈,現在來加強我的排版功力
2022/10/13
最近在把 Tailwind CSS 加入我的技能樹中,其實像這種 Bootstrap, Tailwind CSS 都是很基本前端需要掌握的 CSS 相關工具 但是我其實對美工比較沒那麼大的興趣,我對功能、效能、安全比較感興趣,所以後端、架站、DevOps、一些安全防護玩了一圈,現在來加強我的排版功力
看更多
你可能也想看
Thumbnail
「欸!這是在哪裡買的?求連結 🥺」 誰叫你太有品味,一發就讓大家跟著剁手手? 讓你回購再回購的生活好物,是時候該介紹出場了吧! 「開箱你的美好生活」現正召喚各路好物的開箱使者 🤩
Thumbnail
「欸!這是在哪裡買的?求連結 🥺」 誰叫你太有品味,一發就讓大家跟著剁手手? 讓你回購再回購的生活好物,是時候該介紹出場了吧! 「開箱你的美好生活」現正召喚各路好物的開箱使者 🤩
Thumbnail
我的「媽」呀! 母親節即將到來,vocus 邀請你寫下屬於你的「媽」故事——不管是紀錄爆笑的日常,或是一直想對她表達的感謝,又或者,是你這輩子最想聽她說出的一句話。 也歡迎你曬出合照,分享照片背後的點點滴滴 ♥️ 透過創作,將這份情感表達出來吧!🥹
Thumbnail
我的「媽」呀! 母親節即將到來,vocus 邀請你寫下屬於你的「媽」故事——不管是紀錄爆笑的日常,或是一直想對她表達的感謝,又或者,是你這輩子最想聽她說出的一句話。 也歡迎你曬出合照,分享照片背後的點點滴滴 ♥️ 透過創作,將這份情感表達出來吧!🥹
Thumbnail
這篇文章將會提供在伺服器上安裝憑證的步驟,包括下載憑證,設定php.ini以及重新啟動Web Server等。
Thumbnail
這篇文章將會提供在伺服器上安裝憑證的步驟,包括下載憑證,設定php.ini以及重新啟動Web Server等。
Thumbnail
ModSecurity 是普遍應用之 公開網頁程式防火牆 ( 可 搭配 OWASP (Open Web Application Security Project) 維護的免費核心規則集 Core Rule Set CRS 初始設計 為 Apache HTTP Server 之模組 後續發展成 htt
Thumbnail
ModSecurity 是普遍應用之 公開網頁程式防火牆 ( 可 搭配 OWASP (Open Web Application Security Project) 維護的免費核心規則集 Core Rule Set CRS 初始設計 為 Apache HTTP Server 之模組 後續發展成 htt
Thumbnail
打包網頁 在部署網站之前,我們要先來打包我們的網頁前端專案 為什麼要打包呢?什麼是打包呢?這有點像是編譯,如果你寫過 C 應該講到這裡就理解為什麼要這樣做了 在網頁開發中網頁內容最原始就是直接用 html 下去寫,但一個成熟的開發者會善用框架來開發,不論是用 vue 或 react,樣式的部分也會從
Thumbnail
打包網頁 在部署網站之前,我們要先來打包我們的網頁前端專案 為什麼要打包呢?什麼是打包呢?這有點像是編譯,如果你寫過 C 應該講到這裡就理解為什麼要這樣做了 在網頁開發中網頁內容最原始就是直接用 html 下去寫,但一個成熟的開發者會善用框架來開發,不論是用 vue 或 react,樣式的部分也會從
Thumbnail
歷經千辛萬苦,終於要來架站啦!首先先來介紹我們的架站工具 Nginx,最常用的架站工具主要有兩個,Apache 和 Nginx Apache 的歷史悠久,使用的人數也最多,之前在選擇架站工具時,考量的點是 Apache 比較肥,設定也比較難寫,所以最後選擇 Nginx 作為我的架站工具 Nginx
Thumbnail
歷經千辛萬苦,終於要來架站啦!首先先來介紹我們的架站工具 Nginx,最常用的架站工具主要有兩個,Apache 和 Nginx Apache 的歷史悠久,使用的人數也最多,之前在選擇架站工具時,考量的點是 Apache 比較肥,設定也比較難寫,所以最後選擇 Nginx 作為我的架站工具 Nginx
Thumbnail
Recently, I add some useful settings for my nginx web server. I would like to take a note of some basic and useful settings of nginx. http server
Thumbnail
Recently, I add some useful settings for my nginx web server. I would like to take a note of some basic and useful settings of nginx. http server
Thumbnail
I’m sure that I would forget it again after a few months, so let’s take note of it. Installation We need to use homebrew to install certbot. renew
Thumbnail
I’m sure that I would forget it again after a few months, so let’s take note of it. Installation We need to use homebrew to install certbot. renew
Thumbnail
Error: wamp解法: 1. 下載cacert.pem 到這邊下載: https://curl.se/docs/caextract.html 2. 將檔案放到ssl folder 路徑類似這樣,放在自己使用的php版本下: 3. 在php.ini中加入cacert.pem的path
Thumbnail
Error: wamp解法: 1. 下載cacert.pem 到這邊下載: https://curl.se/docs/caextract.html 2. 將檔案放到ssl folder 路徑類似這樣,放在自己使用的php版本下: 3. 在php.ini中加入cacert.pem的path
Thumbnail
Development environment of Laravel. Nginx, php, mysql and centos 7
Thumbnail
Development environment of Laravel. Nginx, php, mysql and centos 7
Thumbnail
本筆記紀錄如何在Linux(CentOS 8)安裝Nginx, MySQL, PHP環境。...
Thumbnail
本筆記紀錄如何在Linux(CentOS 8)安裝Nginx, MySQL, PHP環境。...
Thumbnail
server OS: CentOS 6.5   ========= LAMP 安裝 =============   1.更新系統到最新版本: yum updata -y 2.安裝Apache網頁伺服器: yum install httpd -y     service httpd start
Thumbnail
server OS: CentOS 6.5   ========= LAMP 安裝 =============   1.更新系統到最新版本: yum updata -y 2.安裝Apache網頁伺服器: yum install httpd -y     service httpd start
追蹤感興趣的內容從 Google News 追蹤更多 vocus 的最新精選內容追蹤 Google News