Certbot,指定重定向而不回答问题

Seb*_*son 5 nginx certbot

所以我试图在脚本中稍微自动化 certbot 。当我运行这个时sudo certbot --nginx -d your_domain -d www.your_domain

我得到以下信息:

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):
Run Code Online (Sandbox Code Playgroud)

我的问题是,我可以以某种方式使其自动选择选项号2而不询问这个问题吗?

换句话说,以某种方式2sudo certbot --nginx -d your_domain -d www.your_domain命令中指定选项而不是交互式的。

0st*_*ne0 7

使用--redirect

sudo certbot --nginx --redirect -d your_domain -d www.your_domain
Run Code Online (Sandbox Code Playgroud)


文档安全部分

在此输入图像描述