How To Completely Removing Nginx on CentOS

Completely Removing Nginx on CentOS

In this tutorial, we will show you how to completely removing Nginx on CentOS systems. For those of you who didn’t know, Nginx is a powerful web server software that can be used on your server. It is also known for its high performance and low memory usage which will allow fewer resources to be used but getting the job done efficiently. A popular set up is to use it as a proxy for Apache, which can then serve application requests.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step by step installation of completely removing Nginx on a CentOS server.

Completely Removing Nginx on CentOS

Step 1. Stop Nginx software.

The first step before we are going to uninstall/remove our NginX is to verify the NginX services in our system, is it running or already stopped:

[ ~]# sudo systemctl stop nginx.service
[ ~]# sudo systemctl disable nginx.servic

Then, remove autostart for Nginx.

[ ~]# chkconfig nginx off

Step 2. Completely Removing Nginx on CentOS system.

Now we delete all Nginx files included engine (binary files), configuration files and also jpg files:

[ ~]# sudo systemctl disable nginx.service
[ ~]# sudo rm -rf /etc/nginx
[ ~]# sudo rm -rf /var/log/nginx
[ ~]# sudo rm -rf /var/cache/nginx/
[ ~]# sudo rm -rf /usr/lib/systemd/system/nginx.service

The final steps is to remove nginx form our CentOS system:

sudo dnf remove nginx

If you don’t know how to reinstall the Nginx web server, check out our tutorial here.

Congratulations! You have successfully remove Nginx. Thanks for using this tutorial for removing the Nginx web server on the CentOS system. For additional help or useful information, we recommend you to check the official Nginx on website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!