NGINX is a popular web server that is also used as load balancer and reverse proxy. But sometimes you may need to remove NGINX from your system, due to performance issues or because you want to use another web server. In this article we will look at how to uninstall NGINX in CentOS. You can use these steps to uninstall NGINX from RHEL & Fedora Linux as well.
How to Uninstall NGINX in Centos
Here are the steps to uninstall NGINX in CentOS. Please note, you will need a user with root privileges to execute the following commands.
1. Stop NGINX Server & Remove Auto Start
Open terminal and run the following commands to stop NGINX server and remove its auto start script.
# sudo systemctl stop nginx.service # sudo systemctl disable nginx.service
Also read : How to Set UTF-8 Encoding in Tomcat Server
2. Remove NGINX user
Run the following command to remove nginx user and its directory.
# sudo userdel -r nginx
Also read : How to Use NGINX try_files
3. Delete NGINX
Run the following commands to delete NGINX installation folder and related directories.
# sudo rm -rf /etc/nginx # sudo rm -rf /var/log/nginx # sudo rm -rf /var/cache/nginx/
Also read : Difference between ServerName and ServerAlias
4. Remove NGINX Service
Finally, run the following commands to remove NGINX service from your system.
# sudo rm -rf /usr/lib/systemd/system/nginx.service
That’s it. NGINX will be completely removed from CentOS/RHEL/Fedora Linux.
Also read : How to Uninstall NGINX from Ubuntu