I'm trying to add new module to nginx with naxsi, but I should reinstall nginx. What is the better way of removing nginx?
Asked
Active
Viewed 7.6e+01k times
2 Answers
422
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
squareborg
- 10,387
- 2
- 32
- 29
-
30`rm -rf /etc/nginx` to remove the conf files too. – scarver2 Nov 09 '13 at 21:10
-
3@scarver2 This is old, but that's what `apt-get purge` does. – squareborg Jul 20 '14 at 13:48
-
3Try also `sudo apt-get purge nginx-common` – Francisco Luz Feb 16 '15 at 03:31
-
4With Ubuntu 14.04, it's now: `sudo apt-get remove nginx-full nginx-common` – Viet Apr 24 '16 at 20:20
-
1also remove your ppa archive if you have some in you /etc/apt/source.list – Balman Rawat Jul 19 '17 at 04:55
-
So there are different packages of nginx : nginx, nginx-full and nginx-common. Right? – Mohammed Shareef C Sep 14 '17 at 13:43
-
`nginx-core` needs to be removed too – Mostafiz Rahman Dec 30 '17 at 05:26
-
This answer helped me to remove ngnix from ec2 [this](https://docs.nginx.com/nginx/deployment-guides/amazon-ec2-instances-for-nginx/) is how it was installed with ansible. – Yevgeniy Afanasyev Nov 30 '18 at 06:32
-
also disable startup script on boot: `sudo systemctl disable nginx` – mahfuz Nov 14 '19 at 08:27
-
Try `sudo apt purge nginx nginx-common nginx-core ; sudo apt autoremove` – Anderson May 30 '23 at 14:36
11
Uninstall everything and install once again
sudo apt remove --purge nginx*
sudo apt autoremove
sudo apt update
sudo apt install nginx
Enjoy
MD SHAYON
- 335
- 4
- 4