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.
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 :
[root@rhel7 ~]# sudo systemctl stop nginx.service
[root@rhel7 ~]# sudo systemctl disable nginx.service
2. Remove Nginx user and it related directory :
[root@rhel7 ~]# sudo userdel -r nginx
3. Delete and related Nginx installation directory :
[root@rhel7 ~]# sudo rm -rf /etc/nginx
[root@rhel7 ~]# sudo rm -rf /var/log/nginx
[root@rhel7 ~]# sudo rm -rf /var/cache/nginx/
4. Remove the created nginx.service script under systemd :
[root@rhel7 ~]# sudo rm -rf /usr/lib/systemd/system/nginx.service