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:
[[email protected] ~]# sudo systemctl stop nginx.service [[email protected] ~]# sudo systemctl disable nginx.servic
Then, remove autostart for Nginx.
[[email protected] ~]# 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:
[[email protected] ~]# sudo systemctl disable nginx.service [[email protected] ~]# sudo rm -rf /etc/nginx [[email protected] ~]# sudo rm -rf /var/log/nginx [[email protected] ~]# sudo rm -rf /var/cache/nginx/ [[email protected] ~]# 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.