NGINX is a popular web server that can be used as http server, reverse proxy and load balancer. However, sometimes you may need to completely remove NGINX from your system due to performance issues, or if you need to try an alternative. You may also need to remove NGINX in case you want to recompile NGINX with a specific module. In this article, we will look at how to uninstall NGINX from Ubuntu. You can also use these steps to remove NGINX from other debian systems.
How to Uninstall NGINX from Ubuntu
Ubuntu provides 3 ways to completely remove a package from its system – remove, purge and reinstall. Let us look at each of them in detail.
1. Remove NGINX
Remove command will uninstall NGINX but leave the configuration files behind. This means that NGINX configuration files at /etc/nginx will not be deleted. Also, the website files at /var/www will also not be deleted. Remove is a useful option if you may want to reinstall NGINX in future.
Here is the command to remove NGINX from Ubuntu
$ sudo apt remove nginx
Also read : How to Exclude File in Git Commit
2. Purge NGINX
Purge command will completely remove NGINX from ubuntu. It will uninstall NGINX as well as delete /etc/nginx folder. So even your NGINX configuration files will be deleted. If you don’t need to reinstall NGINX and do not need its configuration files, then use purge command. It is also useful if you wish to do a fresh installation of NGINX later.
Here is the command to purge NGINX.
$ sudo apt purge nginx
Also read : How to Save iptables rules permanently
3. Reinstall NGINX
Reinstall command will simply remove NGINX package and reinstall it again. It will not make any changes to the configuration files at /var/www. If you have accidentally deleted or edited any of the nginx package files, then reinstall is a good option.
Here is the command to reinstall NGINX
$ sudo apt reinstall nginx
Also read : How to Convert String to UTF8 in Python
In this article, you have learnt the different ways to remove NGINX from Ubuntu. If you need to remove only NGINX software and not its configuration files, use remove option. If you need to remove both NGINX software and its configuration, use purge option. If you simply want to reinstall NGINX use the reinstall option.
Related posts:
Sreeram has more than 10 years of experience in web development, Python, Linux, SQL and database programming.