这一切都始于昨天,我将端口 443 的第二个 IP 地址添加到 Froxlor 的“ips 和端口”列表中。 Froxlor 的 cron 作业一运行,Apache 就无法重新启动。从那以后,我的任何尝试都无法让 Apache 在 Froxlor 中启用 SSL 的情况下保持运行。
系统配置:
来自 sudo systemctl start apache2
的输出:
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
来自 systemctl status apache2.service
的输出:
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2021-07-19 13:33:31 UTC; 41s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 17629 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
systemd[1]: Starting The Apache HTTP Server...
apachectl[17641]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName'>
apachectl[17629]: Action 'start' failed.
apachectl[17629]: The Apache error log may have more information.
systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
systemd[1]: apache2.service: Failed with result 'exit-code'.
systemd[1]: Failed to start The Apache HTTP Server.
来自 sudo journalctl -u apache2.service --since today --no-pager
的输出:
systemd[1]: Starting The Apache HTTP Server...
apachectl[17169]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
apachectl[17165]: Action 'start' failed.
apachectl[17165]: The Apache error log may have more information.
systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
systemd[1]: apache2.service: Failed with result 'exit-code'.
systemd[1]: Failed to start The Apache HTTP Server.
systemd[1]: apache2.service: Unit cannot be reloaded because it is inactive.
“地址已被使用”错误
最初我还收到一个错误,说 apachectl[16500]: (98)Address already in use: AH00072: make_sock: could not bind to address
在端口 443 上。运行 netstat -anp | grep 443
没有显示占用该端口的任何其他进程,所以我怀疑 Apache 试图使用端口 443 两次(它跟踪我的配置错误)。我设法进入数据库并删除了 ip/端口记录(尚未分配给任何站点),此特定错误消失了,因为 Froxlor 停止创建包含 Listen 443
的额外 conf 文件。
如果我在 Listen 443
中注释掉 /etc/apache2/ports.conf
的两个实例,则此特定错误会消失,但 Apache 仍然无法加载。
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf
Listen 80
#<IfModule ssl_module>
# Listen 443
#</IfModule>
#<IfModule mod_gnutls.c>
# Listen 443
#</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
(这篇带有 similar issue 的帖子提供了一些关于这一点的见解)
来自 sudo grep "443" /etc/apache2/*
grep: /etc/apache2/conf-available: Is a directory
grep: /etc/apache2/conf-enabled: Is a directory
grep: /etc/apache2/htpasswd: Is a directory
grep: /etc/apache2/mods-available: Is a directory
grep: /etc/apache2/mods-enabled: Is a directory
/etc/apache2/ports.conf:# Listen 443
/etc/apache2/ports.conf:# Listen 443
grep: /etc/apache2/sites-available: Is a directory
grep: /etc/apache2/sites-enabled: Is a directory
杂项。关于 Froxlor 的评论:
\Froxlor\Cron\MasterCron::run();
中注释掉 /var/www/froxlor/scripts/froxlor_master_cronjob.php
,则 Froxlor cron 作业实际上被禁用。可用于故障排除,但不能解决任何问题。sudo /usr/bin/php /var/www/froxlor/scripts/froxlor_master_cronjob.php --force
将触发 Froxlor 立即执行其 cron 作业当前状态: 经过数小时的故障排除后,以下是我所知道的:
/etc/apache2/sites-enabled/
目录允许 Apache 启动,直到 Froxlor 的 cron 作业重新生成它。/etc/apache2/sites-enabled/
中删除 *.443.conf 文件和任何 ssl.conf 文件也可以暂时允许 Apache 启动(直到 Froxlor cron 作业运行)TLDR:当我打开 Froxlor 并添加第二个 IP 时出现问题,该 IP 的端口已在使用中(端口 443)。现在除非我删除任何涉及 SSH 的 .conf 文件,否则 Apache 不会启动。在重新安装 Froxlor 之前删除 Froxlor(包括删除数据库)和删除 sites-enabled
没有解决问题。
编辑:重新生成了我的安全证书,现在一切正常。