【问题标题】:How to fix Cerbot error 'Unable to find a virtual host listening on port 80' after Apache Update?Apache 更新后如何修复 Cerbot 错误“无法找到侦听端口 80 的虚拟主机”?
【发布时间】:2022-12-23 22:29:57
【问题描述】:

我最近将 Apache 从 2.4.6 更新到 2.4.5x。

现在 certbot renew --dry-run 告诉我 Apache 没有监听端口 80

从/var/log/letsencrypt/letsencrypt.log

PluginError: Unable to find a virtual host listening on port 80 which is currently needed for Certbot to prove to the CA that you control your domain. Please add a virtual host for port 80.

2022-04-27 13:00:18,010:ERROR:certbot._internal.renewal:All renewal attempts failed. The following certs could not be renewed:
2022-04-27 13:00:18,011:ERROR:certbot._internal.renewal:  /etc/letsencrypt/live/co2-avatar.com/fullchain.pem (failure)

但是我的 apache 配置中有一个 <VirtualHost>,其中包含所有请求的域服务器名称/服务器别名.我已经与 netstat 再次确认 Apache 正在侦听端口 80。

这是配置文件:

# redirect everything from http to https
<VirtualHost *:80>
    DocumentRoot "/var/www/html/"
    ServerName co2-avatar.com
    ServerAlias sustainable-data-platform.de
    ServerAlias co2-avatar.de
    ServerAlias co2-avatar.eu
    ServerAlias co2-avatar.org
    ServerAlias co2avatar.com
    ServerAlias co2avatar.de
    ServerAlias co2avatar.eu
    ServerAlias co2avatar.org
    ServerAlias git.sustainable-data-platform.org
    ServerAlias gitlab.sustainable-data-platform.org
    ServerAlias hp-cockpit.com
    ServerAlias hp-cockpit.de
    ServerAlias hp-cockpit.eu
    ServerAlias hp-cockpit.org
    ServerAlias hpcockpit.com
    ServerAlias hpcockpit.de
    ServerAlias hpcockpit.eu
    ServerAlias hpcockpit.org
    ServerAlias stop-fossil.de
    ServerAlias stop-fossil.org
    ServerAlias stopfossil.de
    ServerAlias stopfossil.org
    ServerAlias sustainable-building-platform.com
    ServerAlias sustainable-building-platform.de
    ServerAlias sustainable-building-platform.eu
    ServerAlias sustainable-building-platform.org
    ServerAlias sustainable-data-platform.com
    ServerAlias sustainable-data-platform.eu
    ServerAlias sustainable-data-platform.org
    ServerAlias sustainabledataplatform.com
    ServerAlias sustainabledataplatform.de
    ServerAlias sustainabledataplatform.eu
    ServerAlias sustainabledataplatform.org
    ServerAlias test.co2avatar.org
    ServerAlias test.hp-cockpit.org
    ServerAlias wp-cockpit.de
    ServerAlias wp-cockpit.eu
    ServerAlias wp-cockpit.org
    ServerAlias wpcockpit.eu
    ServerAlias wpcockpit.org

    <Directory "/var/www/html/">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog "/var/log/httpd/webServer-error_log"
    CustomLog "/var/log/httpd/webServer-access_log" combined
    RewriteEngine on
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} !\.well-known/acme-challenge
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

RewriteCond %{REQUEST_URI} !\.well-known/acme-challenge(哪个is from here)可能有问题,但我该如何调试呢?是否有更详细的日志文件来自认证机器人要么加密.

当运行 renew 或当我想将一些域添加到我的证书时,我确实没有在我的 Apache 日志文件中看到任何访问。所以我不确定,我在这里做错了什么以及如何检查,他们这边实际发生了什么(模拟更新 sustainable-data-platform.org 和另外 40 个域的现有证书).当我在我的机器上运行 curl -v -X GET http://co2-avatar.com/.well-known/acme-challenge 时,这是不同的。为此,我至少得到了一个 301 以及我服务器上 Apache 日志文件中的一个条目。

还有其他使用提示吗认证机器人使用 Apache 4.2.53?

【问题讨论】:

    标签: apache vhosts certbot


    【解决方案1】:

    尝试启用您的站点,然后尝试重新安装证书

    sudo a2ensite [站点配置名称]

    【讨论】:

      猜你喜欢
      • 2020-10-12
      • 1970-01-01
      • 1970-01-01
      • 2019-06-23
      • 2019-05-05
      • 2019-05-19
      • 1970-01-01
      • 2017-05-10
      相关资源
      最近更新 更多