How to Uninstall Apache2 from Ubuntu Server

March 4, 2023 . 1 MIN READ

A simple and straightforward method that worked for me is outlined below:

  1. Stop Apache2

    sudo service apache2 stop
  2. Uninstall Apache2 and its dependent packages

    sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common

    or

    sudo apt-get purge apache2 apache2-utils apache2-bin apache2.2-common
  3. Remove unused dependencies

    sudo apt-get autoremove
  4. Check for remaining configuration files

    whereis apache2
  5. Remove leftover configuration directories
    If the output shows something like:

    apache2: /etc/apache2

    remove the directory and any remaining configuration files:

    sudo rm -rf /etc/apache2

This will completely remove Apache2 from your Ubuntu server.

Reference:

https://phpcod.com/how-to-remove-apache2-from-ubuntu-server/

Leave a Reply

Your email address will not be published. Required fields are marked *