Methods of payment Abuse

Uninstall Nginx in Ubuntu

21.10.2022, 12:31

When you install and start the Nginx web server, and further in case you install Apache, OpenLiteSpeed or Lighttpd and with an attempt to start you may find the error Address already in use.

Here the user wonders what it means when port 80 or 443 is occupied by Nginx and another web server cannot use it. Of course, you can use another port or suspend Nginx, on if it is no longer needed then you can remove it altogether. How to uninstall Nginx Ubuntu completely? Next we will tell you about it.

Uninstalling Nginx completely from the system

To stop the Nginx service and remove it from the autoloader, the following command is provided:

$ sudo systemctl stop nginx
$ sudo systemctl disable nginx

This is already enough for another web server to start functioning without unnecessary deletions from the system. If you need to remove it exactly, run the following command:

$ sudo apt purge nginx nginx-common

Удаляем Nginx

To remove packages that were installed during the Nginx installation but are no longer needed, execute:

$ sudo apt autoremove

If a site configuration file was created in the /etc/ directory by manual method using a package manager, you will not be able to remove them.

Use:

$ sudo rm -Rf /etc/nginx/*

Now there should be no questions left on how to completely uninstall Nginx Ubuntu.