Apache 无法启动/重启

Apache 无法启动/重启

我在 Ubuntu 15.10 上使用 Apache 时遇到了问题。当我运行sudo service apache2 restart

出现以下错误:

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 - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
   Active: failed (Result: exit-code) since Sex 2016-01-08 09:05:40 BRST; 5min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 5840 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Jan 08 09:05:40 marcelonote systemd[1]: Starting LSB: Apache2 web server...
Jan 08 09:05:40 marcelonote apache2[5840]: * Starting web server apache2
Jan 08 09:05:40 marcelonote apache2[5840]: *
Jan 08 09:05:40 marcelonote apache2[5840]: * The apache2 configtest failed.
Jan 08 09:05:40 marcelonote apache2[5840]: Output of config test was:
Jan 08 09:05:40 marcelonote apache2[5840]: chown: invalid user: 'victor'
Jan 08 09:05:40 marcelonote systemd[1]: apache2.service: Control process exited, code=exited status=1
Jan 08 09:05:40 marcelonote systemd[1]: Failed to start LSB: Apache2 web server.
Jan 08 09:05:40 marcelonote systemd[1]: apache2.service: Unit entered failed state.
Jan 08 09:05:40 marcelonote systemd[1]: apache2.service: Failed with result 'exit-code'.

journalctl -xe

Jan 08 09:09:09 marcelonote dbus[621]: [system] Activating service name='org.freedesktop.PackageKit' (using servicehelper)
Jan 08 09:09:10 marcelonote AptDaemon[6017]: INFO: Initializing daemon
Jan 08 09:09:10 marcelonote org.freedesktop.PackageKit[621]: 09:09:10 AptDaemon [INFO]: Initializing daemon
Jan 08 09:09:10 marcelonote AptDaemon.PackageKit[6017]: INFO: Initializing PackageKit compat layer
Jan 08 09:09:10 marcelonote org.freedesktop.PackageKit[621]: 09:09:10 AptDaemon.PackageKit [INFO]: Initializing PackageKit compat layer
Jan 08 09:09:10 marcelonote dbus[621]: [system] Successfully activated service 'org.freedesktop.PackageKit'
Jan 08 09:09:10 marcelonote AptDaemon.PackageKit[6017]: INFO: CreateTransaction() was called
Jan 08 09:09:10 marcelonote org.freedesktop.PackageKit[621]: 09:09:10 AptDaemon.PackageKit [INFO]: CreateTransaction() was called
Jan 08 09:09:10 marcelonote AptDaemon.PackageKit[6017]: INFO: Initializing PackageKit transaction
Jan 08 09:09:10 marcelonote org.freedesktop.PackageKit[621]: 09:09:10 AptDaemon.PackageKit [INFO]: Initializing PackageKit transaction
Jan 08 09:09:10 marcelonote AptDaemon.PackageKit[6017]: INFO: GetUpdates() was called
Jan 08 09:09:10 marcelonote org.freedesktop.PackageKit[621]: 09:09:10 AptDaemon.PackageKit [INFO]: GetUpdates() was called
Jan 08 09:09:10 marcelonote AptDaemon.Worker[6017]: INFO: Simulating trans: /org/debian/apt/transaction/e86dea17ca9e4f5e9ecfa4703b955c61
Jan 08 09:09:10 marcelonote org.freedesktop.PackageKit[621]: 09:09:10 AptDaemon.Worker [INFO]: Simulating trans: /org/debian/apt/transaction/e8
Jan 08 09:09:10 marcelonote AptDaemon.Worker[6017]: INFO: Processing transaction /org/debian/apt/transaction/e86dea17ca9e4f5e9ecfa4703b955c61
Jan 08 09:09:10 marcelonote org.freedesktop.PackageKit[621]: 09:09:10 AptDaemon.Worker [INFO]: Processing transaction /org/debian/apt/transacti
Jan 08 09:09:13 marcelonote AptDaemon.Worker[6017]: INFO: Finished transaction /org/debian/apt/transaction/e86dea17ca9e4f5e9ecfa4703b955c61
Jan 08 09:09:13 marcelonote org.freedesktop.PackageKit[621]: 09:09:13 AptDaemon.Worker [INFO]: Finished transaction /org/debian/apt/transaction
Jan 08 09:10:07 marcelonote upowerd[1569]: (upowerd:1569): UPower-Linux-WARNING **: energy 26,833560 bigger than full 26,757575
Jan 08 09:12:07 marcelonote upowerd[1569]: (upowerd:1569): UPower-Linux-WARNING **: energy 26,920400 bigger than full 26,833560
Jan 08 09:12:22 marcelonote systemd[1]: Starting Cleanup of Temporary Directories...
-- Subject: Unit systemd-tmpfiles-clean.service has begun start-up

我尝试重新安装 apache,但问题仍然存在。

跑步grep victor /etc/apache2 -R

/etc/apache2/envvars:export APACHE_RUN_USER=victor
/etc/apache2/envvars:export APACHE_RUN_GROUP=victor

答案1

您的日志显示: Jan 08 09:05:40 marcelonote apache2[5840]: chown: invalid user: 'victor'

似乎没有名为 victor 的用户。将你的/etc/apache2/envvars APACHE_RUN_USER和更改APACHE_RUN_GROUPwww-data,然后重新启动 apache。

答案2

您是否尝试过这个并从终端输入这个:

 cron apache2
 cron restart

这样也许能很好地发挥作用。

相关内容