How to Remove Nginx from Ubuntu 18.04 | 20.04

How to Remove Nginx from Ubuntu System

In this article, we are going to shows that How to remove or purge Nginx from Ubuntu 18.04 | 20.04.

NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. NGINX is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.

If you want to remove Nginx server from your host then there are two methods to uninstall or remove installed programs from Ubuntu and Linux systems:

  1. Run the apt with remove option
  2. Run the apt with purge option

Ubuntu is a Linux Operating System based on Debian and mostly composed of non-profit(free) and open-source software. It is a complete Linux operating system that compatible with desktops, laptops, server and other devices. Ubuntu is Open Source so it is freely available for both community and professional support.

If you are a learner and looking for a Linux distribution for Learning then Ubuntu Linux Operating System is best for you as a beginning.

Please follow below methods to remove Nginx from Ubuntu System :

Prerequisites

  • System with Nginx installed and configured
  • Access to command line
  • A user account with sudo or root privileges

Method 1 : Remove Nginx

if you run the apt with remove option then it will delete Nginx server package from the host and keep all configuration file of Nginx server.

Run the below command, if you want to remove Nginx server package and want to keep all configuration files:

sudo apt remove nginx

When you run the above command, it will delete Nginx server packages and keep all configuration files and content directory of Nginx.

Site configuration file located at /etc/nginx directory and content directory located at /var/www.


Method 2 : Purge Nginx

if you run the apt with purge option then it will delete Nginx server packages and all its configuration files from Ubuntu system.

Run the below command to completely delete Nginx server along with the its configuration files and settings:

sudo apt purge nginx

Reinstall Nginx

if you run the apt with reinstall option then it will delete Nginx server and install it again.

To do that, simply run the below commands:

sudo apt reinstall nginx

That’s all

To install Nginx server in your Ubuntu system, simply follow our article How to Install Nginx on Ubuntu system

If you face any error and issue in above steps , please use comment box below to report.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top