2

I tried to restart my Apache after updating my config

sudo service apache2 restart

I kept getting this

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

How do I prevent that ?

code-8
  • 195

4 Answers4

3

Here is the answer: https://askubuntu.com/a/1022319/850782

cd /etc/apache2
apache2ctl configtest

probably has some typo in some config file that you have created:

vi /etc/apache2/sites-enabled/yoursite.conf
Treedbox
  • 131
1

You may mixed up something in apache2 configuration better to remove and reinstall a fresh apache2 , Hope this will help you .

First uninstall apache2

sudo apt-get purge apache2
sudo apt-get purge apache2-common 
sudo apt-get purge apache* # this will remove completely

sudo apt-get update

Next install fresh apache2

sudo apt-get install apache2 

Next Check for the apache2 status

systemctl status apache2
soldier
  • 479
  • 1
  • 6
  • 17
0

In my case i was already running nginx server on the same PORT. So i used sudo service nginx stop then sudo service apache2 restart and it worked. netstat -plant | grep 80 use this command to see if port is already in use.

jazeb007
  • 191
-1

Re-install apache2

sudo apt-get install apache2

And start your server

sudo service apache2 start