Apache server starts automatically. How to disable it?

Apache server starts automatically on my local machine on system startup. How can I disable it?

Asked By: Shivam Anand

||

Normally Apache server is not installed by default with Ubuntu. However, if it was installed somehow and you decided that you no longer need Apache server, you can completely remove it from the system using:

sudo apt purge apache2

If you need to temporarily disable Apache (without deleting it from the system), you can use:

sudo systemctl stop apache2.service
sudo systemctl disable apache2.service

So that later, if you decide to re-enable it, you can run:

sudo systemctl enable apache2.service
sudo systemctl start apache2.service

Information about the current run status of the Apache server can be obtained by:

systemctl status apache2.service 
Answered By: FedKad

To stop auto restarting of the service at the time of system restart you need to run

sudo systemctl disable service

In your case it will be

sudo systemctl disable apache2

If your user have sudo previledges and it is in sudo group you can remove the sudo part from the command. If not then system will ask you for password of the system.

Answered By: Nikhil Joshi
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.