nginx proxy

How to uninstall Nginx completely in Linux Ubuntu?

Problem definition

Sometimes, we need to uninstall nginx server and also need to remove all the config files. But, it may not remove the config files automatically at first go. So, here I am going to explain all the steps from uninstalling to removing everything.

Solution to uninstall Nginx

First, use the following command:

sudo apt-get remove nginx nginx-common

The above command uninstalls the Nginx but keeps all the config files.

To remove all the configuration files we have another command:

Remove all the config files

sudo apt-get purge nginx nginx-common

The above command should remove everything.

If you want to remove all the dependency that was used by the Nginx which may not be required. Then you can use the following command. (Optional)

sudo apt-get autoremove


Hence, we are able to uninstall Nginx server and its config files.


Notify of
Most Voted
Newest Oldest
Inline Feedbacks
View all comments