我尝试添加新域,但在尝试重新启动 Apache 后,出现以下情况:
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Thu 2017-08-17 07:58:06 UTC; 15s ago
Docs: man:systemd-sysv-generator(8)
Process: 2026 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
Aug 17 07:58:06 server apache2[2026]: AH00112: Warning: DocumentRoot [/etc/sentora/panel/] does not exist
Aug 17 07:58:06 server apache2[2026]: AH00112: Warning: DocumentRoot [/var/sentora/hostdata/trgovac/public_html/trgovac_rs] does not exist
Aug 17 07:58:06 server apache2[2026]: (2)No such file or directory: AH02291: Cannot access directory '/var/sentora/logs/domains/banko-sistemi/' for error log of vhost defined at /etc/apache2/sites-enabled/svi.conf:687
Aug 17 07:58:06 server apache2[2026]: AH00014: Configuration check failed
Aug 17 07:58:06 server apache2[2026]: Action 'configtest' failed.
Aug 17 07:58:06 server apache2[2026]: The Apache error log may have more information.
Aug 17 07:58:06 server systemd[1]: apache2.service: Control process exited, code=exited status=1
Aug 17 07:58:06 server systemd[1]: Failed to start LSB: Apache2 web server.
Aug 17 07:58:06 server systemd[1]: apache2.service: Unit entered failed state.
Aug 17 07:58:06 server systemd[1]: apache2.service: Failed with result 'exit-code'.
有人知道为什么会发生这种情况吗? 我该如何重新启动 Apache?
答案1
您的安装存在一些权限问题。您可以从以下日志的最后两行发现:
Aug 17 07:58:06 server apache2[2026]: AH00112: Warning: DocumentRoot [/etc/sentora/panel/] does not exist
Aug 17 07:58:06 server apache2[2026]: AH00112: Warning: DocumentRoot [/var/sentora/hostdata/trgovac/public_html/trgovac_rs] does not exist
Aug 17 07:58:06 server apache2[2026]: (2)No such file or directory: AH02291: Cannot access directory '/var/sentora/logs/domains/banko-sistemi/' for error log of vhost defined at /etc/apache2/sites-enabled/svi.conf:687
Aug 17 07:58:06 server apache2[2026]: AH00014: Configuration check failed
有 2 个警告(这些只是警告,不会导致 Apache 启动失败,但值得注意)。您在虚拟主机配置中的某处配置了 2 个不存在的文档根目录。一个在 ,/etc/sentora/panel/
另一个在/var/sentora/hostdata/trgovac/public_html/trgovac_rs
。
但是,导致 Apache 无法启动的错误是它试图创建/修改 Apache 无法访问的日志/var/sentora/logs/domains/banko-sistemi/
。
要修复此问题,请确保目录存在,如果不存在,则创建该目录并授予 Apache 访问权限以对其进行修改:
sudo mkdir -p /var/sentora/logs/domains/banko-sistemi
sudo chown -u www-data /var/sentora/logs/domains/banko-sistemi
如果您更改了默认的 Apache 用户,请更改www-data
为您为 Apache 选择的用户。
答案2
我解决了这个问题。我在这个位置 /var/sentora/logs/domains/banko-sistemi/ 创建了目录“banko-sistemi”。
此后我重新启动了 apache,没有任何问题。