1. Run the following command:
1.1 Deleting nginx – Purge includes configuration files
sudo apt-get --purge remove nginx
Copy the code
1.2 Automatically Removing All Software Packages that are not used
sudo apt-get autoremove
Copy the code
1.3 List nginx-related software
dpkg --get-selections|grep nginx
Copy the code
1.4 Delete 1.3 Querying Nginx-related software
sudo apt-get --purge remove nginx
sudo apt-get --purge remove nginx-common
sudo apt-get --purge remove nginx-full
Copy the code
This way you can completely uninstall nginx including configuration files
2. Check the running processes of nginx and kill them
Nginx is still running after executing 1.
ps -ef |grep nginx
Copy the code
2.2. The kill nginx process
sudo kill9 the process IDCopy the code
2.3. global search for nginx-related files
sudo find / -name nginx*
Copy the code
2.4. Yee deletes all files listed in 4
sudo rm -rf file
Copy the code
This removes nginx completely
3. Reinstall
sudo apt-get update
sudo apt-get install nginx
Copy the code
4. Check whether the installation is successful
sudo /etc/init.d/nginx start
Copy the code