问题
I am studying openstack, in the virtual machine, after I change the 00-nova-placement-api.conf,
I want to restart httpd:
systemctl restart httpd
But I get failed:
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
So I execute the
systemctl status httpd.service
I get below information:
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.
I execute the order below:
journalctl -xn
then I got the below information:
[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.
My 00-nova-placement-api.conf is below:
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>
~
Atteention
I find a clew in the information:
: httpd: Syntax error on line 353 of /etc/httpd/conf/httpd.conf: Syntax error on line 14 of /etc/httpd/con... numbers.
the screen-shoot is below:
the 353 line is below:
IncludeOptional conf.d/*.conf
I don't know where is the error.
回答1:
To use the IfVersion directive mod_version needs to be loaded from your httpd.conf (or one of the included conf.d/*.conf files):
LoadModule version_module modules/mod_version.so
Second the format of the directive is:
<IfVersion [[!]operator] version>
And you don't have a space between the directive and the desired version
<IfVersion>=2.4>
to require 2.4 or greater that should probably look like:
<IfVersion >= 2.4>
回答2:
Please, use this:
ErrorLog syslog
Instead of this
ErrorLog /var/log/nova/nova-placement-api.log
That worked for me. More info: http://httpd.apache.org/docs/1.3/mod/core.html#errorlog
来源:https://stackoverflow.com/questions/44280173/job-for-httpd-service-failed-because-the-control-process-exited-with-error-code