Remove Nginx on linux in Vesta control panel - Step by Step process to do it








Are you trying to remove Nginx on Linux in the Vesta control panel?

This guide will help you.


Sometimes, VestaCP users might need to use other Web Servers such as Apache on their control panel and remove Nginx.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform Nginx related queries.

In this context, we shall look into how to remove Nginx on Linux in the Vesta control panel.


Steps to remove Nginx on RHEL/CentOS in Vesta Control Panel ?

Follow the process below to remove Nginx from RHEL/CentOS:

1. First, we stop the Nginx service. For that, we run the below command.

# service nginx stop

2. Next, we remove the Nginx package by running the below command:

# yum remove nginx

3. After that, we change the vesta configuration. For that, we execute the below commands:

# 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

4. Then we change httpd configuration by running below commands:

# cd /etc/httpd/conf.d
# sed -i “s/8080/80/” *.conf
# sed -i “s/8443/443/” *.conf

5. Finally, we rebuild vhost configs:

# for user in $(v-list-sys-users plain); do v-rebuild-web-domains $user; done


To remove Nginx on Debian/Ubuntu in Vesta Control Panel:

1. First, we stop Nginx service by running the below command:

# service nginx stop

2. Next, we remove Nginx package by running the below command:

# apt-get remove nginx

3. After that, we change vesta configuration:

# 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

4. Then we change httpd configuration. For that, we run the below commands:

# cd /etc/apache2/conf.d
# sed -i “s/8080/80/” *.conf
# sed -i “s/8443/443/” *.conf

5. Finally, we rebuild vhost configs:

# for user in $(v-list-sys-users plain); do v-rebuild-web-domains $user; done


How to resolve Nginx error on Vesta Control Panel installation ?

While trying to install VestaCP on Ubuntu with previously installed Nginx, an error occurs when executing the below command:

$ bash vst-install.sh

Here is the error message that appears:

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

To resolve this error, apply the tips given below:

First, we remove Nginx using the following commands:

$ sudo apt-get remove nginx
$ sudo apt-get purge nginx
$sudo apt-get autoremove

If Nginx and all its configuration files are removed, we either use the -f flag mentioned by the installer or rebuild the droplet from the control panel using a stock OS image.

However, with any web hosting control panel, it is always recommended to start from a completely clean server rather than trying to clean it or remove packages.


[Need urgent assistance in resolving Nginx related issues? – We're available 24*7. ]



Conclusion

This article covers how to remove Nginx on Linux in the Vesta control panel. 

Vesta control panel (VestaCP) is an open source hosting control panel, which can be used to manage multiple websites, create and manage email accounts, FTP accounts, and MySQL databases, manage DNS records and more.


To uninstall VestaCP on CentOS, follow the steps below:

1. Connect to your server via SSH as root

2. Stop the Vesta service with service vesta stop:

$ service vesta stop 

3. Delete Vesta packages/software repository:

# yum remove vesta*

and

# rm -f /etc/yum.repos.d/vesta.repo

4. You may also want to remove /usr/local/vesta folder:

# rm -rf vesta

5. Now we have to remove the cron jobs for the user admin.

Let's list first the cron jobs:

# crontab -u admin -l
MAILTO=admin@ibmimedia.com
CONTENT_TYPE="text/plain; charset=utf-8"
15 02 * * * sudo /usr/local/vesta/bin/v-update-sys-queue disk
10 00 * * * sudo /usr/local/vesta/bin/v-update-sys-queue traffic
30 03 * * * sudo /usr/local/vesta/bin/v-update-sys-queue webstats
*/5 * * * * sudo /usr/local/vesta/bin/v-update-sys-queue backup
10 05 * * * sudo /usr/local/vesta/bin/v-backup-users
20 00 * * * sudo /usr/local/vesta/bin/v-update-user-stats
*/5 * * * * sudo /usr/local/vesta/bin/v-update-sys-rrd
40 2 * * * sudo /usr/local/vesta/bin/v-update-sys-vesta-all
03 3 * * * sudo /usr/local/vesta/bin/v-update-letsencrypt-ssl

6. Remove the cron jobs via crontab -u admin -e:

# crontab -u admin -e

7. Save and exit:



For Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on LinuxAPT.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com