Removing Nginx completely from Ubuntu
Tonight I tried to make a clean installation of Nginx in my Virtual Private Server, which is running Ubuntu 12.04, so I ran:
sudo apt-get purge nginx
To my surprise, after running this command the folder /etc/nginx still existed with all its content intact. This was weird because purge (as opposed to remove) should remove configuration files.
Because I am stickler, I decided I wanted to find a way to uninstall nginx with just one command, so I reinstalled it all over and tried again. This time I dug a little around and I found 3 packages that seemed relevant: nginx, nginx-full, and nginx-common. I tried luck with each one of them and this is the one that did it:
sudo apt-get purge nginx-common
Weird right? I would have put my money on nginx-full, but no, this was the one that did it. Now your system is nginx-free with no trace of it anywhere. Now you can reinstall it in a clean state.
Or just leave it uninstalled 🙂