Linux:彻底卸载nginx

1.先执行一下命令:

sudo apt-get --purge remove nginx
sudo apt-get autoremove
dpkg --get-selections|grep nginx

罗列出与nginx相关的软件, nginx-common deinstall 然后

sudo apt-get --purge remove nginx-common

这样就可以完全卸载掉nginx包括配置文件

2.ps -ef |grep nginx 看下nginx还有没有启动,一般执行完1后,nginx还是启动着的,如下:

yo@ubuntu:/$ ps -ef |grep nginx
root     4061  2418  0 Mar11 ?        00:00:00 nginx: master processsbin/nginx
nobody   4062  4061  0 Mar11 ?        00:00:00 nginx: worker process
yo  15487  4229  0 01:13 pts/0    00:00:00 grep --color=auto nginx

3.kill nginx进程

sudo kill -9  4061  4062

4.sudo find / -name nginx*

/usr/local/nginx
/usr/local/nginx/logs/nginx.pid
/usr/local/nginx/conf/nginx.conf.default
/usr/local/nginx/conf/nginx.conf
/usr/local/nginx/sbin/nginx

5.依依删除4列出的所有文件

sudo rm  -r  /usr/local/nginx
sudo rm  -r  /usr/local/nginx/logs/nginx.pid
sudo rm  -r  /usr/local/nginx/conf/nginx.conf.default
sudo rm  -r  /usr/local/nginx/conf/nginx.conf
sudo rm  -r  /usr/local/nginx/sbin/nginx

这样就彻底删除nginx了

本文链接:

http://wanyor.com/2016/09/28/75.html