由于这是一个敏感的客户项目,我所说的所有域名都已替换为“example.com”。
我正在管理一个公共(public)网站,其 Let's Encrypt 证书最近过期。所以我遵循了 DigitalOcean 教程 here并使用 certbot-auto renew
更新证书(是的,之后我运行了 sudo service apache2 reload
)。它有效,但问题是该站点现在同时提供新证书和过期证书,而且似乎是随机选择。有时该站点会因为收到新证书而受到浏览器的信任,有时浏览器会拒绝过期的证书。甚至通过 SSL Labs analyzer 运行网站有时给出 A 级,有时给出失败。
当我的配置明确仅包含新证书时,可能会导致继续使用这两个证书的原因是什么?我很困惑。
现在运行 certbot-auto renew
会得到这个结果:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/example.com.conf
-------------------------------------------------------------------------------
Cert not yet due for renewal
The following certs are not due for renewal yet:
/etc/letsencrypt/live/example.com/fullchain.pem (skipped)
No renewals were attempted
Apache 的 sites-enabled 目录如下所示:
000-default.conf 000-default-le-ssl.conf
每一个的配置如下:
000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
000-default-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
ServerName example.com
</VirtualHost>
</IfModule>
最佳答案
我可以通过调用 sudo service apache2 stop
来停止 apache,然后运行 ps aux | 来解决这个问题。 grep Apache
。我发现有多个 apache 实例在运行。所以我杀了他们并再次启动 apache,现在一切正常。
关于apache - 为什么 Apache 提供新证书和过期证书?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43501462/