Trying to restart apache from terminal using the following command:

 sudo service apache2 restart

When executing that command, I'm getting below error:

Job for apache2.service failed. See "systemctl status apache2.service" and "journalctl -xe" for details.

On excuting "systemctl status apache2.service" I get this output:

apache2.service - (null)
   Loaded: loaded (/etc/init.d/apache2)
   Active: failed (Result: exit-code) since Sat 2015-05-30 02:22:41 IST; 12s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 4866 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Apache error.log:

AH00489: Apache/2.4.12 (Unix) configured -- resuming normal operations
AH00094: Command line: '/usr/local/apache2/bin/httpd'
  • 10
    after you run the apache2 restart and get that error, run sudo journalctl -xe that will give you a better idea about what happened. if you still have issues understanding it. Post the results here.
    – grag42
    Commented May 29, 2015 at 20:50
  • 1
    ok. That didn't help me either. What is in the apache log files. /var/log/apache2/error.log
    – grag42
    Commented May 29, 2015 at 20:56
  • @grag42 thanks for your suggestion, I ran sudo journalctl -xe and found some rewrite rule issue was there and fixed it and its running now. Commented May 29, 2015 at 21:10
  • 4
    Possible duplicate of Apache not starting
    – rancho
    Commented Aug 1, 2016 at 18:15
  • 4
    @rancho: What leads you to believe the question is a duplicate? The linked question contains a quite specific error message which we don't have here. The possible causes for OP's issue a pretty unclear at this moment. Commented Aug 5, 2016 at 13:52

12 Answers 12


There is some syntax error in the file apache2.conf.

In a terminal, type:

cd /etc/apache2


apache2ctl configtest

It will show you where is the error in the apache2.conf file to correct.

  • 2
    great approach tnx, saved my time
    – George G
    Commented Nov 3, 2017 at 18:52
  • 1
    This is fantastic.
    – abalter
    Commented May 24, 2018 at 5:03
  • 1
    Thanks. Was a problem with redmine and PassengerResolveSymlinksInDocumentRoot option.
    – Vadim
    Commented Jun 19, 2018 at 5:24
  • 5
    lol, after execute: apache2ctl configtest got syntax ok, but when i run apache2 --help got apache2: Syntax error on line 82 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot and no errors in apache error.log ! Commented Apr 5, 2019 at 18:52
  • 1
    after see closely to /etc/apache2/sites-enabled/ dir, i noticed, that i got file, not symbolic linc to site.conf + reenable mod php5.6 (sudo a2dismod php5.6 ; sudo a2enmod php5.6) my service apache2 has been started without "ohh-ahh" Commented Apr 5, 2019 at 19:19

Maybe this will help to find the cause:

journalctl | tail

In my case it was a mistake in the configuration file:

AH00526: Syntax error on line 5 of /etc/apache2/sites-enabled/mydomain-wsf.lan.conf
  • 7
    No journal files were found.
    – tread
    Commented Sep 9, 2015 at 19:27
  • 6
    @StevieG, try sudo journalctl | tail
    – Dherik
    Commented Dec 9, 2015 at 12:36
  • 1
    What did you do to fix the thing? Commented Jun 22, 2016 at 15:42
  • in my case, i also did a mistake in the apache2.config file
    – alamin
    Commented Sep 1, 2016 at 7:41
  • Thanks. I wrong typed my directory for my newly added site conf. Commented Feb 28, 2018 at 3:52

The problem is because some configuration files are deleted, you have to reinstall it.


To replace configuration files that have been deleted, without purging the package, you can do:

sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2

To fully remove the apache2 config files, you should:

sudo apt-get purge apache2

which will then let you reinstall it in the usual way with:

sudo apt-get install apache2

Purge is required to remove all the config files - if you delete the config files but only remove the package, then this is remembered & missing config files are not reinstalled by default.


apt-get purge libapache2-mod-php5 php5 && \
apt-get install libapache2-mod-php5 php5
  • 2
    Why do you think some configuration files were deleted? Commented Jun 22, 2016 at 15:43
  • Thank you for pointing me to purge! This one fixed my issues with apache2 not running: $ sudo apt purge apache2 && sudo apt install apache2
    – Fred
    Commented Feb 14, 2022 at 12:23
  • This works for me. Genius! Commented Apr 6, 2023 at 12:12


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


  • To fully remove the apache2 config files, you should:

    1) sudo apt-get purge apache2

  • which will then let you reinstall it in the usual way with:

    2) sudo apt-get install apache2

==> It Works fine...



I got the same error after removing a virtual host. The problem was the lingering SSL conf file associated with that host located in /etc/apache2/sites-enabled. The SSL was through Let's Encrypt so the code for me to remove was:

sudo rm yourdomain.com-le-ssl.conf

you most likely have a syntax error. for me it was in my 'sites-enabled' folder.

i mis-spelled 'ServerAlias' to 'ServerAlisa'.

  • Mine was I misspelled my folder. Commented Feb 28, 2018 at 3:50

I got the Same errors While working with .htaccess

I just put this command

<Directory /var/www/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

in /etc/apache2/sites-enabled/000-default.conf this folder

after adding this i have getting the error

then i delete these peace of command from the file and my error has resolved.


This is mostly a configuration error. I just now had an old site enabled on apache, what caused this error. So I had to disable it before reloading apache.

sudo a2dissite <my-site>
sudo service apache2 reload

Problem solved :)


Thank you for your help! I was able to install correctly with Solution:

To fully remove the apache2 config files, you should:

  1. sudo apt-get purge apache2 which will then let you reinstall it in the usual way with:

  2. sudo apt-get install apache 2

It now works fine.


I think the problem is that you have some site enabled but you deleted its configuration file. Try disabling the site with sudo a2dissite "name" and then restart apache server. At least this was the problem for me and this action solved it.


In my case, the error started to appear after doing apt upgrade. After playing a lot I went to following directories to see what I can disable.

  • /etc/apache2/mods-enabled - a2dismod (to turn back on a2enconf)
  • /etc/apache2/conf-enabled - a2disconf (to turn back on a2enconf)

In my case, I had to those MODS enabled.

enter image description here

It seems that apt-upgrade must have removed/broken php7.2 because as soon as I disabled it and restarted everything worked. Of course, in anyone else's case, it may be something different. When Apache crashes it may be bad config or bad mod. You have to pick your battles.


For what it may be relevant at this stage, but today I came across the same problem and it turned out to be an issue with the certificate file.

So eventually the config was all ok, but in uploading the new .crt content I did in the wrong file, meaning there were no more matching for a particular site and the whole server was refusing to start.

No indication of incorrect SSL certificate in the log or anywhere else, which took me a while to figure out.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .