I installed a LAMP stack with the following commands:

$sudo apt-get install apache2 php5 libapache2-mod-php5
$sudo service apache2 restart
$sudo apt-get install mysql-server mysql-client php5-mysql

Full instructions.

Anyway, I found that Apache isn't the most lightweight server out there, and I found Nginx. So, naturally, I tried uninstalling Apache:

$sudo apt-get purge apache2

I even tried stopping the service before and rebooting afterwards. It goes through the remove process fine, but the service stays there. If I run that command again, it will say that Apache is uninstalled. I've tried uninstalling all of these packages: apache2 php5 libapache2-mod-php5, but, whenever I reboot and go to my Pi's IP, I always get the Apache welcome file.

I then thought that it would be an issue of another web server was handling the Apache file. However, I can still stop the page from loading with sudo service apache2 stop. Why is this happening/how can I fix this?

  • should have used remove command instead of purge
    – lenik
    Jul 22, 2014 at 23:31
  • 2
    @lenik That doesn't seem to be true. From the man apt-get page: purge is identical to remove except that packages are removed and purged (any configuration files are deleted too). Why would removing the configuration files not uninstall a package? Am I overlooking something? Jul 23, 2014 at 0:07
  • 1
    Are you sure Apache is serving the Apache welcome HTML? Perhaps your new web server is.
    – joan
    Jul 23, 2014 at 3:35
  • @joan read the last paragraph Jul 23, 2014 at 11:28

2 Answers 2


Try sudo apt-get --purge remove apache2 and then sudo apt-get autoremove. I had that same thing with emacs due to it installing other dependencies. emacs would still be there after --purge remove. Autoremove helped removing the dependencies which were installed with emacs.

  • Worked! I also had to remove these packages before the autoremove: mysql-server mysql-client php5-mysql. Jul 24, 2014 at 1:47

If these commands don't work:

$ sudo apt-get install apache2 php5 libapache2-mod-php5
$ sudo service apache2 restart
$ sudo apt-get install mysql-server mysql-client php5-mysql  

Try this:

$ sudo apt-get install apache2 php libapache2-mod-php
$ sudo service apache2 restart
$ sudo apt-get install mysql-server mysql-client php-mysql
  • 3
    This does not seem to be an answer to the question.
    – goldilocks
    Jan 2, 2018 at 17:59

Your Answer

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

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