如何在没有交互的情况下安装 Certbot (Let's Encrypt)?
How to install Certbot (Let's Encrypt) without interaction?
我正在编写一个 bash 脚本,它在新安装的服务器中引导整个项目基础结构,我想使用 letcecrypt certbot 配置 ssl 安装。在我执行行之后:
certbot --nginx -d $( get_server_name ) -d www.$( get_server_name ).com
系统提示我提出几个问题。在将某些参数作为参数或其他东西传递时,certbot 可以 运行 没有任何交互吗?
您可以 运行 certbot 'silently' 通过添加以下选项:
--non-interactive --agree-tos -m webmaster@example.com
此处提供完整的配置选项列表:
Certbot 提供了几个 inline flags and "subcommands"(他们的昵称),可以帮助使用 Bash 或 shell 脚本自动生成免费 SSL 证书。
@match 提到的最相关的标志是:
--noninteractive
...或者... --non-interactive
然而实际上这个标志不是很有用,因为它的作用不大。例如,如果脚本中缺少关键标志,证书仍将无法生成。坦率地说,我认为 Certbot 取消上述标志会更好,因为它具有误导性。
以下是所需的最低标志:
--agree-tos
--register-unsafely-without-email
...或... -m username@example.com
-d example.com
and/or -d www.example.com
您还必须指定您想要的 Let's Encrypt installer plugin(环境)类型,例如您可以选择“独立”或“手动”等...对于大多数情况,例如 WordPress 网站服务器,您应该选择“webroot”,以便 Certbot 可以通过 public root 轻松验证所有权(确保对 /.well-known*
的访问未被阻止):
--webroot -w /var/www/html/
这是我们 use in SlickStack 安装 SSL 证书的完整命令:
## install Certbot SSL certificate ##
certbot certonly --noninteractive --agree-tos --cert-name slickstack -d ${SITE_TLD} -d www.${SITE_TLD} -d staging.${SITE_TLD} -d dev.${SITE_TLD} --register-unsafely-without-email --webroot -w /var/www/html/
在我们的例子中,我们将 --cert-name
硬编码为 slickstack
因为每个 VPS 服务器上只安装了一个网站,所以它使其他服务器管理任务(和脚本)更容易管理。但是,如果您在同一台服务器上安装多个域和 SSL 证书,您可以将子命令 --cert-name
更改为以每个 TLD 域命名,等等。这会影响 SSL 目录名称,从而有助于保持您的 files/folders 漂亮整洁。
我正在编写一个 bash 脚本,它在新安装的服务器中引导整个项目基础结构,我想使用 letcecrypt certbot 配置 ssl 安装。在我执行行之后:
certbot --nginx -d $( get_server_name ) -d www.$( get_server_name ).com
系统提示我提出几个问题。在将某些参数作为参数或其他东西传递时,certbot 可以 运行 没有任何交互吗?
您可以 运行 certbot 'silently' 通过添加以下选项:
--non-interactive --agree-tos -m webmaster@example.com
此处提供完整的配置选项列表:
Certbot 提供了几个 inline flags and "subcommands"(他们的昵称),可以帮助使用 Bash 或 shell 脚本自动生成免费 SSL 证书。
@match 提到的最相关的标志是:
--noninteractive
...或者...--non-interactive
然而实际上这个标志不是很有用,因为它的作用不大。例如,如果脚本中缺少关键标志,证书仍将无法生成。坦率地说,我认为 Certbot 取消上述标志会更好,因为它具有误导性。
以下是所需的最低标志:
--agree-tos
--register-unsafely-without-email
...或...-m username@example.com
-d example.com
and/or-d www.example.com
您还必须指定您想要的 Let's Encrypt installer plugin(环境)类型,例如您可以选择“独立”或“手动”等...对于大多数情况,例如 WordPress 网站服务器,您应该选择“webroot”,以便 Certbot 可以通过 public root 轻松验证所有权(确保对 /.well-known*
的访问未被阻止):
--webroot -w /var/www/html/
这是我们 use in SlickStack 安装 SSL 证书的完整命令:
## install Certbot SSL certificate ##
certbot certonly --noninteractive --agree-tos --cert-name slickstack -d ${SITE_TLD} -d www.${SITE_TLD} -d staging.${SITE_TLD} -d dev.${SITE_TLD} --register-unsafely-without-email --webroot -w /var/www/html/
在我们的例子中,我们将 --cert-name
硬编码为 slickstack
因为每个 VPS 服务器上只安装了一个网站,所以它使其他服务器管理任务(和脚本)更容易管理。但是,如果您在同一台服务器上安装多个域和 SSL 证书,您可以将子命令 --cert-name
更改为以每个 TLD 域命名,等等。这会影响 SSL 目录名称,从而有助于保持您的 files/folders 漂亮整洁。