溫馨提示×

centos certbot證書如何獲取

小樊
145
2025-01-01 12:17:49
欄目: 智能運維

Certbot 是一個自動化獲取和部署 Let’s Encrypt SSL/TLS 證書的工具

  1. 安裝 Certbot:

在 CentOS 上安裝 Certbot,首先需要確保已經安裝了 EPEL 和 certbot-apache 或 certbot-nginx 軟件包??梢允褂靡韵旅畎惭b:

sudo yum install epel-release
sudo yum install certbot-apache

或者

sudo yum install epel-release
sudo yum install certbot-nginx
  1. 獲取證書:

使用 Certbot 獲取證書非常簡單。只需運行以下命令,將 yourdomain.com 替換為你的域名:

對于 Apache:

sudo certbot --apache

對于 Nginx:

sudo certbot --nginx

Certbot 將自動檢測你的 Web 服務器類型并執行相應的操作。按照提示完成證書的獲取和配置過程。

  1. 驗證證書:

獲取證書后,可以使用以下命令驗證證書是否已經正確安裝:

sudo certbot check
  1. 自動更新證書:

Let’s Encrypt 的 SSL/TLS 證書有效期為 90 天。為了確保網站始終使用有效的證書,可以設置 Certbot 自動更新證書。運行以下命令,將 yourdomain.com 替換為你的域名:

對于 Apache:

sudo certbot --apache --renew-hook "/path/to/your/renew_hook.sh"

對于 Nginx:

sudo certbot --nginx --renew-hook "/path/to/your/renew_hook.sh"

這里,/path/to/your/renew_hook.sh 是一個腳本文件,用于在證書更新時執行相應的操作。你可以根據需要創建和修改這個腳本。

現在,你已經成功獲取并配置了 Let’s Encrypt 證書。你的網站將使用 HTTPS 進行加密通信。

0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女