linux - httpd.service 的作业失败,因为控制进程退出并显示错误代码

标签 linux apache centos openstack

我在学习openstack,在虚拟机中,我修改了00-nova-placement-api.conf之后,

我想重启httpd:

systemctl restart httpd

但是我失败了:

Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

所以我执行

systemctl status httpd.service

我得到以下信息:

x— httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2017-05-31 16:50:51 CST; 24s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 34969 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 34967 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 34967 (code=exited, status=1/FAILURE)

May 31 16:50:51 controller1 systemd[1]: Starting The Apache HTTP Server...
May 31 16:50:51 controller1 httpd[34967]: httpd: Syntax error on line 353 of /etc/httpd/conf/httpd.conf: Syntax error on line 16 of /etc/httpd/con...fVersion>
May 31 16:50:51 controller1 systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
May 31 16:50:51 controller1 kill[34969]: kill: cannot find process ""
May 31 16:50:51 controller1 systemd[1]: httpd.service: control process exited, code=exited status=1
May 31 16:50:51 controller1 systemd[1]: Failed to start The Apache HTTP Server.
May 31 16:50:51 controller1 systemd[1]: Unit httpd.service entered failed state.

May 31 16:50:51 controller1 systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

我执行下面的命令:

journalctl -xn

然后我得到以下信息:

[root@controller1 ~]# journalctl -xn
-- Logs begin at Tue 2017-05-30 19:27:19 CST, end at Wed 2017-05-31 17:58:53 CST. --
May 31 17:58:48 controller1 systemd[1]: Unit openstack-nova-api.service entered failed state.
May 31 17:58:48 controller1 systemd[1]: openstack-nova-api.service failed.
May 31 17:58:49 controller1 systemd[1]: openstack-nova-api.service holdoff time over, scheduling restart.
May 31 17:58:49 controller1 systemd[1]: Starting OpenStack Nova API Server...
-- Subject: Unit openstack-nova-api.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit openstack-nova-api.service has begun starting up.
May 31 17:58:53 controller1 systemd[1]: openstack-nova-api.service: main process exited, code=exited, status=1/FAILURE
May 31 17:58:53 controller1 systemd[1]: Failed to start OpenStack Nova API Server.
-- Subject: Unit openstack-nova-api.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit openstack-nova-api.service has failed.
--
-- The result is failed.
May 31 17:58:53 controller1 systemd[1]: Unit openstack-nova-api.service entered failed state.
May 31 17:58:53 controller1 systemd[1]: openstack-nova-api.service failed.
May 31 17:58:53 controller1 systemd[1]: openstack-nova-api.service holdoff time over, scheduling restart.
May 31 17:58:53 controller1 systemd[1]: Starting OpenStack Nova API Server...
-- Subject: Unit openstack-nova-api.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit openstack-nova-api.service has begun starting up.

我的 00-nova-placement-api.conf 如下:

Listen 8778

<VirtualHost *:8778>
WSGIProcessGroup nova-placement-api
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGDaemonProcess nova-placement-api processes=3 threads=1 user=nova group=nova
WSGIScriptAlias //usr/bin/nova-placement-api
<Directory "/">
    Order allow,deny
    Allow from all
    Require all granted
</Directory>
<IfVersion>=2.4>
    ErrorLogFormat "%M"
</IfVersion>
    ErrorLog /var/log/nova/nova-placement-api.log
</VirtualHost>

Alias /nova-placement-api /usr/bin/nova-placement-api
<Location /nova-placement-api>
    SetHandler wsgi-script
    Options + ExecCGI
    WSGIProcessGroup nova-placemnet-api
    WSGIApplicationGroup %{GLOBAL}
    WSGIPassAuthorization On
</Location>
~

注意

我在资料中找到了一个线索:

: httpd: Syntax error on line 353 of /etc/httpd/conf/httpd.conf: Syntax error on line 14 of /etc/httpd/con... numbers.

截图如下:

enter image description here

353行如下: IncludeOptional conf.d/*.conf

不知道哪里出错了

最佳答案

使用IfVersion需要从您的 httpd.conf(或包含的 conf.d/*.conf 文件之一)加载指令 mod_version:

LoadModule version_module modules/mod_version.so

第二个指令的格式是:

<IfVersion [[!]operator] version> 

指令和所需版本之间没有空格

<IfVersion>=2.4>

要求 2.4 或更高版本可能如下所示:

<IfVersion >= 2.4>

关于linux - httpd.service 的作业失败,因为控制进程退出并显示错误代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44280173/

相关文章:

linux - Linux上的二进制grep?

java - 如何使用 Java 凭据连接到网络驱动器?

Apache - 如何获取 REMOTE_USER 变量

centos - CentOS 默认 confiteor repos 和 vault (online repos) 之间有什么关系

r - 如何在 CentOS 6 上配置和构建 lzma?

c - Linux 3.0 : "glibc detected" abort - tuning corruption detected feature?

java - Debian 3.16 上缺少 libswt-gtk-3349.so

database - 提高 web2py 性能 - 数据库和 apache

一个文件夹中的 PHP 文件正在执行,但在其他几个文件夹中没有执行

Linux centos : ping displays unknown host for any domain name