CentOS – Job for httpd.service Failed

centosmod-sslssl

after following this tutorial :https://www.digitalocean.com/community/tutorials/how-to-create-an-ssl-certificate-on-apache-for-centos-7

I have tried everything I possibly can to fix the error I have gone through the steps to ensure I correctly entered the details

I got to this point:

sudo apachectl restart

I keep getting this error.

Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details.

I have tried restarting httpd service but that get's the same error

after executing systemctl status httpd.service I got :

httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
   Active: failed (Result: exit-code) since Thu 2015-04-30 13:54:04 EDT; 2min 7s ago
  Process: 30331 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 29403 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
  Process: 30330 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 30330 (code=exited, status=1/FAILURE)

for the second command journalctl -xn I get :

   -- Logs begin at Thu 2015-04-30 07:01:51 EDT, end at Thu 2015-04-30 13:57:37 EDT. --
Apr 30 13:54:04 user sudo[30325]: user : TTY=pts/0 ; PWD=/home/user; USER=root ; COMMAND=/sbin/apachectl restart
Apr 30 13:54:04 user systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
Apr 30 13:54:04 user httpd[30330]: AH00526: Syntax error on line 100 of /etc/httpd/conf.d/ssl.conf:
Apr 30 13:54:04 user httpd[30330]: SSLCertificateFile: file '/etc/httpd/ssl/apache.srt' does not exist or is empty
Apr 30 13:54:04 user systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Apr 30 13:54:04 user kill[30331]: kill: cannot find process ""
Apr 30 13:54:04 user systemd[1]: httpd.service: control process exited, code=exited status=1
Apr 30 13:54:04 user 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.
Apr 30 13:54:04 user systemd[1]: Unit httpd.service entered failed state.
Apr 30 13:57:37 user sudo[30336]: user: TTY=pts/0 ; PWD=/home/user; USER=root ; COMMAND=/bin/journalctl -xn
-- Logs begin at Thu 2015-04-30 07:01:51 EDT, end at Thu 2015-04-30 13:57:37 EDT. --
Apr 30 13:54:04 user sudo[30325]: user: TTY=pts/0 ; PWD=/home/user; USER=root ; COMMAND=/sbin/apachectl restart
Apr 30 13:54:04 user systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
Apr 30 13:54:04 user httpd[30330]: AH00526: Syntax error on line 100 of /etc/httpd/conf.d/ssl.conf:
Apr 30 13:54:04 user httpd[30330]: SSLCertificateFile: file '/etc/httpd/ssl/apache.srt' does not exist or is empty
Apr 30 13:54:04 user systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Apr 30 13:54:04 user kill[30331]: kill: cannot find process ""
Apr 30 13:54:04 user systemd[1]: httpd.service: control process exited, code=exited status=1
Apr 30 13:54:04 user 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.
Apr 30 13:54:04 user systemd[1]: Unit httpd.service entered failed state.
Apr 30 13:57:37 user sudo[30336]: user: TTY=pts/0 ; PWD=/home/user; USER=root ; COMMAND=/bin/journalctl -xn
...skipping...
-- Logs begin at Thu 2015-04-30 07:01:51 EDT, end at Thu 2015-04-30 13:57:37 EDT. --
Apr 30 13:54:04 user sudo[30325]: user: TTY=pts/0 ; PWD=/home/user; USER=root ; COMMAND=/sbin/apachectl restart
Apr 30 13:54:04 user systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
Apr 30 13:54:04 user httpd[30330]: AH00526: Syntax error on line 100 of /etc/httpd/conf.d/ssl.conf:
Apr 30 13:54:04 user httpd[30330]: SSLCertificateFile: file '/etc/httpd/ssl/apache.srt' does not exist or is empty
Apr 30 13:54:04 user systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Apr 30 13:54:04 user kill[30331]: kill: cannot find process ""
Apr 30 13:54:04 user systemd[1]: httpd.service: control process exited, code=exited status=1
Apr 30 13:54:04 user 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.
Apr 30 13:54:04 user systemd[1]: Unit httpd.service entered failed state.
Apr 30 13:57:37 user sudo[30336]: user: TTY=pts/0 ; PWD=/home/user ; USER=root ; COMMAND=/bin/journalctl -xn

IT says the files do no exist etc/httpd/conf.d/ssl.conf and .key but they do :/

Best Answer

The key error message appears to be:

SSLCertificateFile: file '/etc/httpd/ssl/apache.srt' does not exist or is empty

Which is likely a small typo in /etc/httpd/conf.d/ssl.conf in the name of the SSL public key component of your certificate, most likely it should be apache.crt instead of apache.srt