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

标签 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):

我的问题是, 我能否以某种方式让它自动选择选项编号 2 而无需询问此问题?

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

最佳答案

使用--redirect

sudo certbot --nginx --redirect -d your_domain -d www.your_domain


documentation安全 部分

enter image description here

关于nginx - Certbot,指定重定向而不回答问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61973786/

相关文章:

nginx - 路径的 Kubernetes 入口白名单 IP

ubuntu - nginx 将非 www 重定向到 www 和 https

ssl - 是否可以使用 certbot 更新证书的到期日期,但不更新证书内容?

ssl - ISPConfig LetsEncrypt 和自签名证书损坏的配置

nginx - Capistrano 3 无权查询此 Phusion Passenger 实例的状态

ruby-on-rails - 使用 ActionCable 将 Rails 部署到生产环境中通过 HTTPS 运行的 Nginx/Puma

regex - Nginx - 在 uwsgi_pass 之前重写 request_uri

docker - 需要 'y'响应的Docker构建镜像

ssl - 如何使用 certbot 修复错误设置 SSL?

node.js - 使 .well-known 目录在 Express 4 中可见