
如何在 amazon Linux 上安裝 Let's Encrypt 憑證 我已經託管了一個 WordPress 網站。
誰能告訴我如何開始使用它的步驟、命令是什麼、應該更改哪些權限以及如何編輯 ssl.conf 並添加證書和自動續訂。
答案1
亞馬遜的 EPEL 似乎沒有適合我的 certbot。嘗試手動安裝它,這裡有兩篇包含完整說明的文章:
嘗試https://ivopetkov.com/b/let-s-encrypt-on-ec2/對於阿帕契
或者https://coderwall.com/p/e7gzbq/https-with-certbot-for-nginx-on-amazon-linux對於 Nginx
不足的是:
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
sudo certbot-auto certonly --debug --standalone -d yourdomain.com
--debug
是必需的,因為 Amazon Linux 尚未經過 certbot 的充分測試。替換--standalone
為您喜歡的 certbot 外掛程式。本質上只是將標準範例的用法替換certbot
為certbot-auto
。
如果您每隔一段時間檢查 certbot 是否實際出現在 Amazon 的 EPEL 儲存庫中和/或重新下載 certbot-auto 以希望獲得錯誤修復/改進,這可能是最好的。
「Amazon Linux 2」的更新
終於有一個certbot包了EPEL百勝儲存庫。
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum-config-manager --enable epel
sudo yum install certbot
sudo certbot certonly --standalone -d yourdomain.com
答案2
網路上有很多解決方案;我認為你必須繼續嘗試,直到找到適合你的。後很多在實驗過程中,對我有用的是遵循 Apache 和 CentOS 6 的 certbot 說明。這裡,但為了保持一致性:
在終端機中執行以下命令:
- 下載證書機器人
wget https://dl.eff.org/certbot-auto
sudo mv certbot-auto /usr/local/bin/certbot-auto
sudo chown root /usr/local/bin/certbot-auto
sudo chmod 0755 /usr/local/bin/certbot-auto
- 執行Certbot
sudo /usr/local/bin/certbot-auto --apache
如果出現錯誤訊息,請閱讀警告並運行(如果您覺得舒服):
sudo /usr/local/bin/certbot-auto --apache --debug
在這裡,您可能會被要求完成一些相當直觀的問題來配置您的安裝。如果沒有,對我有效的方法對你也不起作用。 :(
- 自動續訂
測試一下更新憑證是否有效:
sudo /usr/local/bin/certbot-auto renew --dry-run
如果是這樣,請導航至系統的 crontab(通常位於 附近/etc/crontab/
)並添加以下程式碼以在每天的午夜和中午檢查(並運行,如果需要)和自動更新:
0 0,12 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/local/bin/certbot-auto renew
答案3
在 nginx 上設定它的替代方法:
您可以使用
sudo yum install python2-pip
sudo pip2 install certbot
對我來說是 python2.7 所以:
cd /usr/lib/python2.7/site-packages
然後運行
sudo certbot --nginx -d your-domain