Apache 重启失败

Apache 重启失败

我正在 letsencrpt 的 certbot 中添加一个新证书,当我重新启动 apache2 时发生了这种情况。

sudo apache2ctl 配置测试

输出:

    apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Syntax error on line 14 of /etc/apache2/sites-enabled/in.morphing.myop-le-ssl.conf: Could not open configuration file /etc/letsencrypt/options-ssl-apache.conf: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.

答案1

我遇到了一些类似的问题。我更新到 Raspbian Stretch,问题就开始了。使用 certbot-auto -renew 时无法创建虚拟环境。我开始卸载并重新安装各种东西,但总是遇到错误。最后我取消注释了 /etc/network/interfaces 中的配置,因为这需要在 /etc/dhcpcd.conf 中,否则网络接口会出现错误,dhcpcd 服务将无法正确启动。

之后,我能够更新证书,但遇到了您的问题。我认为在安装和重新安装时文件被删除了。因此,我从 Apache2 文件夹中复制了配置文件:

cp /etc/letsencrypt/certbot-ci/certbot_integration_tests/assets/sample-config/options-ssl-apache.conf /etc/letsencrypt/options-ssl-apache.conf

然后我禁用了 SSL,并在 sites-enabled 文件夹中的默认 conf 中禁用了重定向。(我的网站重定向到了不同的端口和地址,不确定这是否适用于您)。

sudo a2dismod ssl
sudo service apache2 restart

然后服务就可以启动了,我就可以更新证书了。然后我确保证书移动到了正确的位置,并且配置文件 /etc/apache2/sites-enabled/000-default-le-ssl.conf 包含证书的正确路径。(我的配置是 mydomain-001.nl/fullchain.pem,而在新配置中则是 mydomain.nl/fullchain.pem。

再次启用 SSL:

sudo a2enmod ssl
sudo service apache2 restart

最后它又恢复正常了 :) 我不是专家,但我希望这能帮助你解决问题。如有其他问题,请随时提问。

相关内容