如何在 Ubuntu 18.04 上设置 Let’s Encrypt

[ad_1]

每天都越来越需要使用 SSL 的站点。 它无处不在的执法挑战了网站加密,甚至是谷歌已经采取的一项努力。 由于易于实施,Certbot 和 Let’s Encrypt 是大型和小型企业的流行解决方案。 Certbot 是一个软件客户端,可以下载到服务器上,比如我们的一个 Ubuntu VPS 服务器,以安装和自动更新 SSL。 它通过与名为 Let’s Encrypt 的知名 SSL 提供商合作获得这些 SSL。 在本教程中,我们将向您展示在您的网站上启用 HTTPS 的快速方法。 让我们开始吧!

飞行前

  • Apache 已为您的域安装了一个虚拟主机文件
  • 以 root 用户身份登录
  • 您的域需要 A 记录,Let’s Encrypt 验证将通过 DNS 查找执行

步骤1: 更新 易于 以确保我们使用最新的打包工具。

apt update && upgrade

第2步: 我们将安装 Certbot 软件,因为这将有助于从 Let’s Encrypt 获取 SSL(证书)。 类型 当提示继续时。

sudo apt install certbot

第 3 步: 安装 Certbot Apache 包也是必需的。 类型 当提示继续时。

apt install python-certbot-apache

步骤4: 是时候从 Let’s Encrypt 获得 SSL。 Enter 您的电子邮件地址并按照提示进行操作。 此步骤将查看您的 /etc/apache2/sites-available/yourdomain.com.conf 文件,特别是使用 服务器名称 指示。

注意如果您的安装给出“授权程序失败”消息确保您已按照 Apache 配置文章,并且为您的域设置了 A 记录。

certbot --apache

-------------------------------------------------------------------------------
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v01.api.letsencrypt.org/directory
-------------------------------------------------------------------------------
(A)gree/(C)ancel: A

您选择加入他们的时事通讯。
-------------------------------------------------------------------------------
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
-------------------------------------------------------------------------------
(Y)es/(N)o:

从我们的跳 Apache 配置教程,我们希望我们的两个域都为访问者提供 www 和非 www 选项。 我们将输入留空并点击 进入.

Which names would you like to activate HTTPS for?
-------------------------------------------------------------------------------
1: domain.com
2: www.domain.com
3: domain2.com
4: www.domain2.com
-------------------------------------------------------------------------------
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):

在我们的教程中,我们将选择 重定向 选项,您可以选择 无重定向 如果您仍然希望通过 HTTP 访问您的站点。

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):2

将出现一条祝贺消息以及您的 SSL 证书在哪里的说明,以防您以后需要它们。

- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/domain.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/domain.com/privkey.pem
Your cert will expire on 2019-07-16. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
Donating to EFF:                    https://eff.org/donate-le

第 5 步: 通过在浏览器中访问您的站点来验证您的域是否已获得 Let’s Encrypt SSL。 如果您看不到 SSL 锁,请务必清除浏览器。

您现在有一个 SSL 加密到您的站点的流量。 需要指出的几点:

  • SSL 一次有效期为 90 天
  • Let’s Encrypt 会自动更新
  • 来自 Let’s Encrypt 的任何通知都将发送到邮件中指定的电子邮件地址 .conf 文件

获取我们完全托管的 VPS 服务器,您可以通过 WHM 控制面板控制 Let’s Encrypt。 您不仅将获得一个干净的控制面板来调整服务器方面,而且您还可以获得触手可及的 24/7 支持。 看看我们的服务器如何制作 admin 任务更轻松!

[ad_2]

Related Posts