PaulSarda
By:
PaulSarda

Apache Server not starting centos 7

March 3, 2016 31.9k views
Apache

Hi after i addedIncludeOptional sites-enabled/*.conf to /etc/httpd/conf/httpd.conf i have been getting this error Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
here is thesystemctl status httpd.service -l

 httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2016-03-03 04:00:31 EST; 1min 25s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 2153 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 2152 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 2152 (code=exited, status=1/FAILURE)

Mar 03 04:00:31 centos-512mb-sfo1-01 systemd[1]: Starting The Apache HTTP Server...
Mar 03 04:00:31 centos-512mb-sfo1-01 httpd[2152]: httpd: Syntax error on line 354 of /etc/httpd/conf/httpd.conf: Could not open configuration file /etc/httpd/sites-enabled/example2.com.conf: No such file or directory
Mar 03 04:00:31 centos-512mb-sfo1-01 systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Mar 03 04:00:31 centos-512mb-sfo1-01 kill[2153]: kill: cannot find process ""
Mar 03 04:00:31 centos-512mb-sfo1-01 systemd[1]: httpd.service: control process exited, code=exited status=1
Mar 03 04:00:31 centos-512mb-sfo1-01 systemd[1]: Failed to start The Apache HTTP Server.
Mar 03 04:00:31 centos-512mb-sfo1-01 systemd[1]: Unit httpd.service entered failed state.
Mar 03 04:00:31 centos-512mb-sfo1-01 systemd[1]: httpd.service failed.

i have tried reinstalling httpd but it did not resolve the issue.

4 Answers

Hi @PaulSarda!

Take a look at this line of the log:

Mar 03 04:00:31 centos-512mb-sfo1-01 httpd[2152]: httpd: Syntax error on line 354 of /etc/httpd/conf/httpd.conf: Could not open configuration file /etc/httpd/sites-enabled/example2.com.conf: No such file or directory

I'm guessing that /etc/httpd/sites-enabled/example2.com.conf is a symlink. If you run the following command:

ls -lah /etc/httpd/sites-enabled/example2.com.conf

it should output some info about the file and show you what it's pointing to if it is indeed a symlink. Make sure that the path is valid and is of a file that does exist. If it isn't, you can just delete it and recreate it properly:

ln -s /etc/httpd/sites-available/example2.com.conf /etc/httpd/sites-enabled/example2.com.conf

Im getting the same error when restarting httpd.

Here are my details, also note, I created the folders, and edited the files as ROOT user. Is that ok.

httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2016-09-22 19:06:47 UTC; 1min 30s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 4926 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 4925 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 4925 (code=exited, status=1/FAILURE)

Sep 22 19:06:47 server2.detroitgrit.com httpd[4925]: (2)No such file or directory: AH02291: Cannot access directory '/etc/httpd/${APACHELOGDIR}/' for error log of vhost defined at /etc/httpd/sites-enabled/rovermarketing.com.conf:1
Sep 22 19:06:47 server2.detroitgrit.com httpd[4925]: (2)No such file or directory: AH02291: Cannot access directory '/var/www/detroitgrit.com/' for error log of vhost defined at /etc/httpd/sites-enabled/detroitgrit.com.conf:1
Sep 22 19:06:47 server2.detroitgrit.com httpd[4925]: (2)No such file or directory: AH02291: Cannot access directory '/etc/httpd/${APACHELOGDIR}/' for error log of vhost defined at /etc/httpd/sites-enabled/avexpressions.com.conf:1
Sep 22 19:06:47 server2.detroitgrit.com httpd[4925]: AH00014: Configuration check failed
Sep 22 19:06:47 server2.detroitgrit.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Sep 22 19:06:47 server2.detroitgrit.com kill[4926]: kill: cannot find process ""
Sep 22 19:06:47 server2.detroitgrit.com systemd[1]: httpd.service: control process exited, code=exited status=1
Sep 22 19:06:47 server2.detroitgrit.com systemd[1]: Failed to start The Apache HTTP Server.
Sep 22 19:06:47 server2.detroitgrit.com systemd[1]: Unit httpd.service entered failed state.
Sep 22 19:06:47 server2.detroitgrit.com systemd[1]: httpd.service failed.

I am getting the same error need help in debugging the same

● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2017-04-25 13:18:31 CEST; 7min ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 2421 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 2419 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 2419 (code=exited, status=1/FAILURE)

Apr 25 13:18:31 concordbox.com systemd[1]: Starting The Apache HTTP Server...
Apr 25 13:18:31 concordbox.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Apr 25 13:18:31 concordbox.com kill[2421]: kill: cannot find process ""
Apr 25 13:18:31 concordbox.com systemd[1]: httpd.service: control process exited, code=exited status=1
Apr 25 13:18:31 concordbox.com systemd[1]: Failed to start The Apache HTTP Server.
Apr 25 13:18:31 concordbox.com systemd[1]: Unit httpd.service entered failed state.
Apr 25 13:18:31 concordbox.com systemd[1]: httpd.service failed.

Have another answer? Share your knowledge.