单元 apache2.service 已开始启动

单元 apache2.service 已开始启动

我从 debian 7 升级到了 8(是的 - 相当晚了),所以从 apache2.4 升级到了 2.4,在我升级到 debian 9 之前,我需要一些关于这个问题的帮助:

当我启动 apache 时我得到了这个:

Nov 14 15:20:32 srv087 apache2[27920]: Starting web server: apache2 failed!
Nov 14 15:20:32 srv087 apache2[27920]: The apache2 instance did not start within 20 seconds. Please read the log files to discover problems ... (warning).
Nov 14 15:20:32 srv087 systemd[1]: apache2.service: control process exited, code=exited status=1
Nov 14 15:20:32 srv087 systemd[1]: Failed to start LSB: Apache2 web server.
Nov 14 15:20:32 srv087 systemd[1]: Unit apache2.service entered failed state.

但该 ID 的服务器正在运行:

27934   root            15:20   /usr/sbin/apache2 -k start
27937   www-data    15:20   /usr/sbin/apache2 -k start
27938   www-data    15:20   /usr/sbin/apache2 -k start
27939   www-data    15:20   /usr/sbin/apache2 -k start

在错误日志中我得到了这个:

[Wed Nov 14 15:20:12.229256 2018] [core:warn] [pid 27934] AH00098: pid file /var/run/apache2.pid overwritten -- Unclean shutdown of previous Apache run?
[Wed Nov 14 15:20:12.235164 2018] [mpm_prefork:notice] [pid 27934] AH00163: Apache/2.4.10 (Debian) OpenSSL/1.0.1t configured -- resuming normal operations
[Wed Nov 14 15:20:12.235224 2018] [core:notice] [pid 27934] AH00094: Command line: '/usr/sbin/apache2'


# journalctl -xn

-- Unit apache2.service has finished shutting down. Nov 14 16:13:51 srvxx systemd[1]: Starting LSB: Apache2 web server...
-- Subject: Unit apache2.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit apache2.service has begun starting up.
   Nov 14 16:13:51 srvxx apache2[30226]: Starting web server: apache2httpd (pid 29324) already running
   Nov 14 16:14:11 srvxx apache2[30226]: failed! Nov 14 16:14:11 srvxx apache2[30226]: The apache2 instance did not start within 20 seconds. Please read the log files to discover problems ... (warning).
   Nov 14 16:14:11 srvxxsrvxx systemd[1]: apache2.service: control process exited, code=exited status=1
   Nov 14 16:14:11 srvxx systemd[1]: Failed to start LSB: Apache2 web server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit apache2.service has failed.
--
-- The result is failed. Nov 14 16:14:11 srv087 systemd[1]: Unit apache2.service entered failed state.

Web 服务器: Apache/2.4.10 (Debian) OpenSSL/1.0.1t PHP 版本: 7.0.32-2+0~20181015120515.7+jessie~1.gbpa6b8cf MySQL 服务器版本: 5.6.39-1~dotdeb+7.1-log Web 服务器接口: APACHE2HANDLER

我必须将锁文件设置从默认设置更改 /var/lock/apache2/accept.lockMutex file:${APACHE_LOCK_DIR}默认设置。

使用原始设置,apache 无法启动

可能是互斥锁配置有错误,

# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
# temporary state file location. This might be changed to /run in Wheezy+1
export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

任何有用的提示都将受到赞赏。

答案1

解决了 

envars 发生改变

导出 APACHE_PID_FILE=/var/run/apache2$SUFFIX.pid

进入:

导出 APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid

相关内容