229

I'm trying to add new module to nginx with naxsi, but I should reinstall nginx. What is the better way of removing nginx?

0

2 Answers 2

432

Removes all but config files.

sudo apt-get remove nginx nginx-common

Removes everything.

sudo apt-get purge nginx nginx-common

After using any of the above commands, use this in order to remove dependencies used by nginx which are no longer required.

sudo apt-get autoremove
10
  • 30
    rm -rf /etc/nginx to remove the conf files too.
    – scarver2
    Nov 9, 2013 at 21:10
  • 3
    @scarver2 This is old, but that's what apt-get purge does.
    – squareborg
    Jul 20, 2014 at 13:48
  • 3
    Try also sudo apt-get purge nginx-common Feb 16, 2015 at 3:31
  • 4
    With Ubuntu 14.04, it's now: sudo apt-get remove nginx-full nginx-common
    – Viet
    Apr 24, 2016 at 20:20
  • 1
    also remove your ppa archive if you have some in you /etc/apt/source.list Jul 19, 2017 at 4:55
13

Uninstall everything and install once again

sudo apt remove --purge nginx*
sudo apt autoremove
sudo apt update
sudo apt install nginx

Enjoy

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .