Apache,问题无法启动LSB:Apache2 Web服务器

韦伯

我使用Ubuntu 16.02。当我尝试时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.

然后输入:journalctl -xe,然后请求:

--
单元apache2.service已开始启动。
1月11日02:30:46 aleksandr-VirtualBox apache2 [8177]:/ etc / init.d / apache2:1:/ etc / apache2 / envvars:envvars:未找到
1月11 02:30:46 aleksandr-VirtualBox apache2 [8177 ]:/etc/init.d/apache2:49:/ etc / apache2 / envvars:envvars:找不到
Jan 11 02:30:46 aleksandr-VirtualBox apache2 [8177]:/etc/init.d/apache2 :1: / etc / apache2 / envvars:envvars:找不到
Jan 11 02:30:46 aleksandr-VirtualBox apache2 [8177]:/etc/init.d/apache2:49:/ etc / apache2 / envvars:envvars:找不到
Jan 11 02:30:46 aleksandr-VirtualBox apache2 [8177]:*启动Apache httpd Web服务器apache2 
1月11日02:30:46 aleksandr-VirtualBox apache2 [8177]:*
1月11日02:30:46 aleksandr-VirtualBox apache2 [8177]:* apache2 configtest失败。
1月11日02:30:46 aleksandr-VirtualBox apache2 [8177]:配置测试的输出为:
1月11日02:30:46 aleksandr-VirtualBox apache2 [8177]:/ usr / sbin / apache2ctl:1:/ etc / apache2 / envvars:envvars:找不到
Jan 11 02:30:46 aleksandr-VirtualBox apache2 [8177]:/ usr / sbin / apache2ctl:49:/ etc / apache2 / envvars:envvars:找不到
Jan 11 02:30:46 aleksandr- VirtualBox apache2 [8177]:(2)没有这样的文件或目录:AH02291:无法访问目录'/ etc / apache2 / logs /'作为主要错误日志
1月11日02:30:46 aleksandr-VirtualBox apache2 [8177]:AH00014:配置检查失败
1月11日02:30:46 aleksandr-VirtualBox apache2 [8177]:操作'configtest'失败。
1月11日02:30:46 aleksandr-VirtualBox apache2 [8177]:Apache错误日志可能包含更多信息。
1月11日02:30:46 aleksandr-VirtualBox systemd [1]:apache2.service:控制进程已退出,代码=退出状态= 1
月11日02:30:46 aleksandr-VirtualBox sudo [8171]:pam_unix(sudo:session) :用户root 
1月11日02:30:46的会话已关闭aleksandr-VirtualBox systemd [1]:无法启动LSB:Apache2 Web服务器。
-主题:单位apache2.service失败
-定义-通过:systemd 
-支持:http://lists.freedesktop.org/mailman/listinfo/systemd-devel 
- 
-单位apache2.service失败。
--
结果失败。
1月11日02:30:46 aleksandr-VirtualBox systemd [1]:apache2.service:设备进入失败状态。
1月11日02:30:46 aleksandr-VirtualBox systemd [1]:apache2.service:失败,返回结果为“退出代码”。
1月11日02:33:09 aleksandr-VirtualBox dhclient [792]:在enp0s8上的192.168.56.101的DHCPREQUEST到192.168.56.100端口67(xid = 0x204f076f)
1月11日02:33:09 aleksandr-VirtualBox dhclient [792]:DHCPACK从192.168.56.100 
1月11日192.168.56.101 02:33:09 aleksandr-VirtualBox NetworkManager [619]:[1484073189.4253]地址192.168.56.101 
1月11日02:33:09 aleksandr-VirtualBox NetworkManager [619]:[1484073189.4260]请24( 255.255.255.0)
1月11日02:33:09 aleksandr-VirtualBox NetworkManager [619]:[1484073189.4266]服务器标识符192.168.56.100  
1月11日02:33:09 aleksandr-VirtualBox NetworkManager [619]:[1484073189.4273]租约时间1200
1月11日02:33:09 aleksandr-VirtualBox NetworkManager [619]:[1484073189.4279] dhcp4(enp0s8):状态更改范围->范围
1月11日02:33:09 aleksandr-VirtualBox dbus [590]:[系统]通过systemd激活:service name ='org.freedesktop.nm_dispatcher'unit ='dbus-org.freedesktop.nm-dispatcher.service'Jan 
11 02:33:09 aleksandr-VirtualBox systemd [1]:正在启动网络管理器脚本调度程序服务... 
-主题:单位NetworkManager的-dispatcher.service已经开始启动
-定义-通过:systemd 
-支持:
- 
-单位NetworkManager的-dispatcher.service已经开始启动。
1月11日02:33:09 aleksandr-VirtualBox dhclient [792]:绑定到192.168.56.101-在559秒内进行更新。
1月11日02:33:09 aleksandr-VirtualBox dbus [590]:[系统]成功激活服务'org.freedesktop.nm_dispatcher'- 
1月11日02:33:09 aleksandr-VirtualBox systemd [1]:启动了网络管理器脚本分派器服务。
主题:Unit NetworkManager-dispatcher.service已完成启动
-定义:由:systemd 
-支持:
-- 
Unit NetworkManager-dispatcher.service已完成启动。
--
启动结果已完成。
1月11日02:33:09 aleksandr-VirtualBox nm-dispatcher [8205]:要求:1'dhcp4-change'[enp0s8]:新请求(1个脚本)
1月11日02:33:09 aleksandr-VirtualBox nm-dispatcher [8205] ]:req:1'dhcp4-change'[enp0s8]:开始运行有序脚本...

systemctl status apache2.service它最有趣的时候:

* apache2.service-LSB:Apache2 Web服务器
   已加载:已加载(/etc/init.d/apache2;错误;供应商预设:已启用)
  插件:
           /lib/systemd/system/apache2.service.d`-apache2- systemd.conf
   活动的:自2017年11月11日星期三以来失败(结果:退出代码); 33分钟前
     Docs:man:systemd-sysv-generator(8)
  进程:8023 ExecStop = / etc / init.d / apache2 stop(code = exited,status = 0 / SUCCESS)
  进程:2236 ExecReload = / etc / init.d / apache2重新加载(代码=已退出,状态= 0 /成功)
  进程:8177 ExecStart = / etc / init.d / apache2启动(代码=已退出,状态= 1 /失败)

1月11日02:30:46 aleksandr-VirtualBox apache2 [8177]:/ usr / sbin / apache2ctl:1:/ etc / apache2 / envvars:envvars:未找到 
1月11日02:30:46 aleksandr-VirtualBox apache2 [8177]:/ usr / sbin / apache2ctl:49:/ etc / apache2 / envvars:envvars:未找到
1月11日02:30:46 aleksandr-VirtualBox apache2 [8177]:(2)没有这样的文件或目录:AH02291:无法访问目录'/ etc / apache2 / logs /'作为主要错误日志
1月11日02:30:46 aleksandr -VirtualBox apache2 [8177]:AH00014:配置检查失败
1月11日02:30:46 aleksandr-VirtualBox apache2 [8177]:操作'configtest'失败。
1月11日02:30:46 aleksandr-VirtualBox apache2 [8177]:Apache错误日志可能包含更多信息。
1月11日02:30:46 aleksandr-VirtualBox systemd [1]:apache2.service:控制进程已退出,代码=退出状态= 1 1
月11日02:30:46 aleksandr-VirtualBox systemd [1]:无法启动LSB:Apache2网络服务器。
1月11日02:30:46 aleksandr-VirtualBox systemd [1]:apache2.service:设备进入失败状态。
1月11日02:30:46 aleksandr-VirtualBox systemd [1]:apache2.service:失败,返回结果为“退出代码”。

怎么了?中断在哪里?请帮忙!

pa4080

有两个错误:


1.由于某种原因,您/etc/apache2/envvars不见了:

  • 来自journalctl -xe

    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /etc/init.d/apache2: 1: /etc/apache2/envvars: envvars: not found
    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /etc/init.d/apache2: 49: /etc/apache2/envvars: envvars: not found
    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /etc/init.d/apache2: 1: /etc/apache2/envvars: envvars: not found
    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /etc/init.d/apache2: 49: /etc/apache2/envvars: envvars: not found
    ...        
    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /usr/sbin/apache2ctl: 1: /etc/apache2/envvars: envvars: not found
    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /usr/sbin/apache2ctl: 49: /etc/apache2/envvars: envvars: not found
    
  • 来自systemctl status apache2.service

    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /usr/sbin/apache2ctl: 1: /etc/apache2/envvars: envvars: not found
    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /usr/sbin/apache2ctl: 49: /etc/apache2/envvars: envvars: not found
    

在我的系统中,此文件具有下一个权限:

$ ls -l /etc/apache2/envvars

-rw-r--r--   1 root root  1782 мар 19  2016 envvars

其内容($ cat /etc/apache2/envvars)为:

# envvars - default environment variables for apache2ctl

# this won't be correct after changing uid
unset HOME

# for supporting multiple apache2 instances
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
        SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
        SUFFIX=
fi

# 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

## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
#. /etc/default/locale

export LANG

## The command to get the status for 'apache2ctl status'.
## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
#export APACHE_LYNX='www-browser -dump'

## If you need a higher file descriptor limit, uncomment and adjust the
## following line (default is 8192):
#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'

## If you would like to pass arguments to the web server, add them below
## to the APACHE_ARGUMENTS environment.
#export APACHE_ARGUMENTS=''

## Enable the debug mode for maintainer scripts.
## This will produce a verbose output on package installations of web server mod                                               ules and web application
## installations which interact with Apache
#export APACHE2_MAINTSCRIPT_DEBUG=1

您可以手动创建它:sudo nano /etc/apache2/envvars,将上面的内容粘贴到其中,保存ctrl+o并退出ctrl+ x


2.在您的系统中,该文件夹/etc/apache2/logs还丢失:

  • 来自journalctl -xe

    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: (2)No such file or directory: AH02291: Cannot access directory '/etc/apache2/logs/' for main error log
    
  • 来自systemctl status apache2.service

    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: (2)No such file or directory: AH02291: Cannot access directory '/etc/apache2/logs/' for main error log
    

这不是默认的日志文件夹,它是在您的自定义配置中定义的,并且必须创建:

$ sudo mkdir /etc/apache2/logs

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章