How to Remove / Uninstall Nginx on CentOS 7 / RHEL 7 / Oracle Linux 7

Share this Article :

Nginx web server is alternative web server to Apache and Lighttpd. Nginx popularity now growing because it focuses on high concurrency, high performance while maintaining low memory usage. However, due to certain reasons webmaster or system administrator can not use Nginx on their server and decide to uninstall Nginx. Most of the webmaster, administrator and programmer still prefer to user Apache over Nginx as a web server because of the following reasons :

  • Not many webmaster, administrator and programmer comfortable with Nginx configuration
  • Apache has built-in support for a wide range of web programming languages, including Perl, PHP and Python
  • Apache languages are easy to learn and can be used to create powerful online applications
  • Apache is still the most popular web server on the Internet
  • Apache is the oldest web server, you won’t have any trouble finding people skilled in configuring it.
Also Read :   How to Install EPEL Yum Repository on Linux CentOS 7 / RHEL 7

For the linux server platform that running on CentOS 7, RHEL 7 and Oracle linux 7, the removal step for Nginx is quite different from older version. Therefore, this article will explain the steps to remove or uninstall Nginx that was installed from source on CentOS 7, RHEL 7 and Oracle Linux 7.

Note : These steps to Remove / Uninstall Nginx has been tested on CentOS, RHEL and Oracle Linux platform and was running under root privilege.

1. Stop Nginx service and remove Nginx auto start script :

[[email protected] ~]# sudo systemctl stop nginx.service
[[email protected] ~]# sudo systemctl disable nginx.service

2. Remove Nginx user and it related directory :

[[email protected] ~]# sudo userdel -r nginx

3. Delete and related Nginx installation directory :

[[email protected] ~]# sudo rm -rf /etc/nginx
[[email protected] ~]# sudo rm -rf /var/log/nginx
[[email protected] ~]# sudo rm -rf /var/cache/nginx/

4. Remove the created nginx.service script under systemd :

[[email protected] ~]# sudo rm -rf /usr/lib/systemd/system/nginx.service

Uninstall Nginx

Leave a Reply