Complete Guide to Removing Nginx on Linux Using Vesta Control Panel

Complete Guide to Removing Nginx on Linux Using Vesta Control Panel

Nginx is a popular load balancer used in many web servers to manage websites and web application. Besides that, it is also used as a mail proxy, reverse proxy, and HTTP Cache.

At times, you’d have to uninstall this useful web server. When you get to that stage, you might be wondering how to remove Nginx on your Linux system. If you happen to be using Vesta Control Panel, then this article is for you. Learn how to remove Nginx on Linux using VestaCP.

vesta.jpg


For RHEL/CentOS

If you’re using RHEL (Red Hat Enterprise Linux) or CentOS as your operating system, then below are the steps you need to follow:

Stop the running Nginx service by running this command -
Code:
# service nginx stop
Next, remove the Nginx package using this command -
Code:
# yum remove nginx
In the next step, you need to make changes to the Vesta configuration. So execute the following commands:

Code:
# cd /usr/local/vesta/conf
# sed -i “/PROXY_*/d” vesta.conf
# sed -i “s/8080/80/” vesta.conf
# sed -i “s/8443/443/” vesta.conf
Run the following commands to change httpd configuration:

Code:
# cd /etc/httpd/conf.d
# sed -i “s/8080/80/” *.conf
# sed -i “s/8443/443/” *.conf
As the final step, rebuild the vhost configs using this command - # for user in $(v-list-sys-users plain); do v-rebuild-web-domains $user; done

For Debian/Ubuntu

If you’re using a Debian or Ubuntu OS for running your systems, follow these steps:

Stop Nginx service using this command -
Code:
# service nginx stop
Remove the installed Nginx package using this command -
Code:
# apt-get remove nginx
Run the below commands to change Vesta configuration:

Code:
# cd /usr/local/vesta/conf
# sed -i “/PROXY_*/d” vesta.conf
# sed -i “s/8080/80/” vesta.conf
# sed -i “s/8443/443/” vesta.conf
Change httpd config using the below commands:

Code:
# cd /etc/apache2/conf.d
# sed -i “s/8080/80/” *.conf
# sed -i “s/8443/443/” *.conf
Lastly, rebuild vhost configuration using this command - # for user in $(v-list-sys-users plain); do v-rebuild-web-domains $user; done

These steps will remove teh Nginx web server from your Linux server.

Nginx Errors While Removing

When running the removal process, you might come across some errors. Especially when you execute this command, you’ll notice an error - bash vst-install.sh

The error message will be -

Code:
“Following packages are already installed:
nginx
It is highly recommended to remove them before proceeding.
If you want to force installation run this script with -f option:
Example: bash vst-install-ubuntu.sh –force”
As and when you get this error, you can remove Nginx using the commands mentioned below:

Code:
sudo apt-get remove nginx
sudo apt-get purge nginx
sudo apt-get autoremove
Once Nginx along with its config files are removed, use either of the following:

Use -f flag mentioned as directed by the installer

Using a stock OS image, rebuild the droplet from the Vesta Control Panel.

But it’s highly recommended that you start from a clean server rather than cleaning it or removing packages. If you face further difficulty while removing Nginx, contact your hosting provider.
Author
kumkumsharma
Views
3,162
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from kumkumsharma

Top