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 ?

4 Answers 4

2

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

-1

Re-install apache2

sudo apt-get install apache2

And start your server

sudo service apache2 start

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.