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. Read More : Installing LAMP on RHEL or Centos 7

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.

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

2. Remove NGINX user

Run the following command to remove nginx user and its directory.

# sudo userdel -r nginx

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/

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.

Leave a Reply