apache2.service failed “systemctl status apache2.service” and “journalctl -xe” for details

The issue:

We got this issue when we tried to restart apache2 from command line using the following command:

$ sudo service apache2 restart

// The error we got: 
Job for apache2.service failed. See "systemctl status apache2.service" and "journalctl -xe" for details.

The reason:

There could be multiple reasons for this issue. In our case it was a syntax issue inside apache2 config file.

The solution:

We can solve this issue in multiple ways. We can run the configtest command to detect the place of the syntax issue. To the the configtest first of all go inside apache2 directory and then run the following command:

$ cd /etc/apache2
$ sudo apache2ctl configtest
Share