我知道如何使用命令行安装 ssl 证书。但是这次我需要一个 shell 脚本来完成这个任务。
通常在手动执行此操作时,我首先执行以下操作:-
sudo apt-get install certbot python-certbot-nginx
Run Code Online (Sandbox Code Playgroud)
通过执行上述我将被要求继续或不?[是/否]。我将输入'Y'。然后我将执行以下命令
sudo certbot --nginx
Run Code Online (Sandbox Code Playgroud)
执行上述将要求我按顺序回答以下步骤:
完成所有这些步骤后,https 将被启用。现在我需要通过 shell 文件以编程方式完成这些事情。我想使用这个来安装 certbot 和 python-certbot-nginx
sudo apt-get install certbot python-certbot-nginx -y
Run Code Online (Sandbox Code Playgroud)
但我不知道如何进一步进行,因为我从未使用过 shell 脚本
PS:我在执行 sudo certbot --nginx 并自己输入详细信息时提供示例结果。
sudo certbot --nginx
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): mygmailid@gmail.com
- - …Run Code Online (Sandbox Code Playgroud) 这可能是一个简单的错误,但我似乎无法certbot用来验证我的域。我正在使用连接到快速应用程序的 nginx。我已经注释掉了默认 nginx 文件中的配置,它只包含我的站点的配置/etc/nginx/conf.d/mysite.info。在我的配置中,第一个位置条目指向根/.well-known/acme-challenge目录。这是我的 nginx conf 文件中的设置:
server {
listen 80;
server_name <MYDOMAIN>.info www.<MYDOMAIN>.info;
location '/.well-known/acme-challenge' {
root /srv/www/<MY_ROOT_DIRECTORY>;
}
location / {
proxy_pass http://localhost:4200;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /secure {
auth_pam "Secure zone";
auth_pam_service_name "nginx";
}
}
Run Code Online (Sandbox Code Playgroud)
为了验证,我使用了以下 certbot 命令:
certbot certonly --agree-tos --email <My_EMAIL>@gmail.com --webroot -w /srv/www/<ROOT_FOLDER>/ -d <DOMAIN>.info
Run Code Online (Sandbox Code Playgroud)
certbot的错误如下:
Performing the following challenges:
http-01 challenge for <MYDOMAIN>.info
Using the webroot …Run Code Online (Sandbox Code Playgroud) 我试图找到有关在 docker 容器中运行 certbot 的简单文档,但我能找到的只是运行 certbot + web 服务器等的复杂指南。官方页面有点无用... https://hub.docker。 com/r/certbot/certbot/。我已经有与我的网站分开的网络服务器,并且我也想自己运行 certbot。
任何人都可以给我一些关于如何mysite.com使用/opt/mysite/html.
由于我已经在端口 443 和 80 上提供了服务,因此我正在考虑在 certbot 需要时使用“主机网络”,但我不太明白为什么当我的网站已经通过 443 提供服务时它需要访问 443。
我找到了类似的东西来生成 certbot 容器,但我不知道如何“使用它”或告诉它为我的网站生成证书。
例如:
WD=/opt/certbot
mkdir -p $WD/{mnt,setup,conf,www}
cd $WD/setup
cat << 'EOF' >docker-compose.yaml
version: '3.7'
services:
certbot:
image: certbot/certbot
volumes:
- type: bind
source: /opt/certbot/conf
target: /etc/letsencrypt
- type: bind
source: /opt/certbot/www
target: /var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'" …Run Code Online (Sandbox Code Playgroud) 我在运行 Apache 的 AWS EC2 实例上有一个 Ubuntu 20.04 服务器,我正在尝试使用 certbot 获取证书,但是我在获取凭据时遇到了问题。下面是我运行的命令,后面是错误输出:
user@address:~$ sudo certbot certonly --dns-route53 --dns-route53-propagation-seconds 30 -d mydomain.com -d *.mydomain.com -i apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator dns-route53, Installer apache
Obtaining a new certificate
Performing the following challenges:
dns-01 challenge for mydomain.com
dns-01 challenge for mydomain.com
Cleaning up challenges
Unable to locate credentials
To use certbot-dns-route53, configure credentials as described at https://boto3.readthedocs.io/en/latest/guide/configuration.html#best-practices-for-configuring-credentials and add the necessary permissions for Route53 access.
Run Code Online (Sandbox Code Playgroud)
我遵循了以下指南:
我正在尝试使用 certbot 和 --webroot 设置获取 SSL 证书。我当前的命令是:
sudo certbot certonly --webroot -w <path> -d <URL> -d <*.URL>
Run Code Online (Sandbox Code Playgroud)
每次运行该命令时,我都会收到此错误:
Client with the currently selected authenticator does not support any combination of challenges that will satisfy the CA. You may need to use an authenticator plugin that can do challenges over DNS.
Client with the currently selected authenticator does not support any combination of challenges that will satisfy the CA. You may need to use an authenticator plugin that can do challenges …Run Code Online (Sandbox Code Playgroud) 下面是我的 nginx 配置。我修改了“默认”文件(位于“可用站点”)。当通过“http”时我能够访问该网站。但是当我尝试通过“https”时,连接超时并且无法访问该页面。奇怪的是,Nginx 没有在日志中记录任何条目(access.log 和 error.log)。我正在寻求帮助,因为我对此完全陌生。
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80;
listen [::]:80;
root /var/www/main.x.com/html;
index index.html
server_name main.x.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
server {
listen 443 ssl;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/letsencrypt/live/main.x.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/main.x.com/privkey.pem;
server_name main.x.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location …Run Code Online (Sandbox Code Playgroud) 每当我使用 certbot 进行测试时,我都担心会超出速率限制,从而导致我的帐户受到限制。所以我同时使用--dry-run和--staging选项。
这在许多其他问题和教程中都得到了体现——而且由于它有效,我从不担心它。
但我确信它们之间有区别......它是什么?
我正在使用 certbot 的 cloudflare 插件为我的域生成通配符证书。
现在我也想使用--apache插件来更新 apache 配置。
我尝试运行以下命令
certbot -d example.in -d *.example.in --dns-cloudflare --apache
Run Code Online (Sandbox Code Playgroud)
显然,该应用程序抛出以下错误。
Too many flags setting configurators/installers/authenticators 'apache' -> 'dns-cloudflare'
Run Code Online (Sandbox Code Playgroud)
我需要 cloudflare 插件来自动验证通配符 dns,但同时我还需要 apache 插件来自动设置配置。
这可以实现吗?如果可以,如何实现?
我正在尝试使用命令更新数字海洋上的 SSL 证书certbot renew但出现此错误:
绑定到端口 80 的问题:无法绑定到 IPv4 或 IPv6。
运行netstat -plunt显示端口 80 已被“docker-proxy”使用。
如果我停止 docker-proxy,我该怎么做才能解决这个问题,我该怎么做?
我一直在尝试按照https://certbot.eff.org/lets-encrypt/ubuntuxenial-nginx上的说明安装 Certbot但是,当我尝试运行时sudo certbot --nginx,它返回Too many flags setting configurators/installers/authenticators 'webroot' -> 'nginx'
谁知道要检查什么才能解决这个错误?