Apache Server not starting centos 7

March 3, 2016 90.5k 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.

7 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.

I am also facing same issue while trying to start httpd

{noformat}
Oct 05 12:33:02 localhost.localdomain polkitd[881]: Registered Authentication Agent for unix-process:7663:338694 (system bus name :1.138 [/usr/bin/pkttyagent --notify-fd 5 -
Oct 05 12:33:02 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

-- Unit httpd.service has begun starting up.
Oct 05 12:33:02 localhost.localdomain httpd[7669]: AH00543: httpd: bad user name apache
Oct 05 12:33:02 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Oct 05 12:33:02 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- Unit httpd.service has failed.

-- The result is failed.
Oct 05 12:33:02 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
Oct 05 12:33:02 localhost.localdomain systemd[1]: httpd.service failed.
Oct 05 12:33:03 localhost.localdomain polkitd[881]: Unregistered Authentication Agent for unix-process:7663:338694 (system bus name :1.138, object path /org/freedesktop/Poli
Oct 05 12:33:04 localhost.localdomain NetworkManager[978]: <error> [1538722984.756558] [rdisc/nm-lndp-rdisc.c:241] sendrs(): (eno16777736): cannot send router solicitation:
Oct 05 12:33:08 localhost.localdomain NetworkManager[978]: <error> [1538722988.767018] [rdisc/nm-lndp-rdisc.c:241] send
rs(): (eno16777736): cannot send router solicitation:
Oct 05 12:33:12 localhost.localdomain NetworkManager[978]: <error> [1538722992.760824] [rdisc/nm-lndp-rdisc.c:241] sendrs(): (eno16777736): cannot send router solicitation:
Oct 05 12:33:16 localhost.localdomain NetworkManager[978]: <error> [1538722996.760242] [rdisc/nm-lndp-rdisc.c:241] send
rs(): (eno16777736): cannot send router solicitation:
Oct 05 12:33:20 localhost.localdomain NetworkManager[978]: <error> [1538723000.755711] [rdisc/nm-lndp-rdisc.c:241] sendrs(): (eno16777736): cannot send router solicitation:
Oct 05 12:33:24 localhost.localdomain NetworkManager[978]: <error> [1538723004.759564] [rdisc/nm-lndp-rdisc.c:241] send
rs(): (eno16777736): cannot send router solicitation:
Oct 05 12:33:28 localhost.localdomain NetworkManager[978]: <error> [1538723008.756734] [rdisc/nm-lndp-rdisc.c:241] sendrs(): (eno16777736): cannot send router solicitation:
Oct 05 12:33:32 localhost.localdomain NetworkManager[978]: <error> [1538723012.760193] [rdisc/nm-lndp-rdisc.c:241] send
rs(): (eno16777736): cannot send router solicitation:
Oct 05 12:33:36 localhost.localdomain NetworkManager[978]: <error> [1538723016.760556] [rdisc/nm-lndp-rdisc.c:241] sendrs(): (eno16777736): cannot send router solicitation:
Oct 05 12:33:40 localhost.localdomain NetworkManager[978]: <error> [1538723020.755842] [rdisc/nm-lndp-rdisc.c:241] send
rs(): (eno16777736): cannot send router solicitation:
Oct 05 12:33:44 localhost.localdomain NetworkManager[978]: <error> [1538723024.755955] [rdisc/nm-lndp-rdisc.c:241] send_rs(): (eno16777736): cannot send router solicitation:
lines 1181-1221/1281 95%

{noformat}

my SE linux is Permisive.

<VirtualHost *:80>
ServerName www.YOURDOMAIN.COM
ServerAlias YOURDOMAIN.COM
DocumentRoot /var/www/YOURDOMAIN.COM/public_html
ErrorLog /var/www/YOURDOMAIN.COM/error.log
CustomLog /var/www/YOURDOMAIN.COM/requests.log combined

DocumentRoot /var/www/YOURDOMAIN.COM/public_html
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/YOURDOMAIN.COM/public_html>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

</VirtualHost>

Have another answer? Share your knowledge.