ubuntu16.04彻底删除nginx

1.先执行一下命令:

1.1 删除nginx,–purge包括配置文件

sudo apt-get --purge remove nginx
 
 
  • 1
  • 1

1.2 自动移除全部不使用的软件包

sudo apt-get autoremove

 
 
  • 1
  • 2
  • 1
  • 2

1.3 罗列出与nginx相关的软件

dpkg --get-selections|grep nginx
 
 
  • 1
  • 1
执行1.3的结果:
stephen@stephen-OptiPlex-390:~$ dpkg --get-selections|grep nginx
nginx                       install
nginx-common                    install
nginx-core                  install

 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

1.4 删除1.3查询出与nginx有关的软件

sudo apt-get --purge remove nginx
sudo apt-get --purge remove nginx-common
sudo apt-get --purge remove nginx-core
 
 
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

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

2.查看nginx正在运行的进程,如果有就kill掉

ps -ef |grep nginx
 
 
  • 1
  • 1

看下nginx还有没有启动,一般执行完1后,nginx还是启动着的,如下:

stephen@stephen-OptiPlex-390:~$ ps -ef |grep nginx
root      7875  2317  0 15:02 ?        00:00:00 nginx: master process /usr/sbin/nginx
www-data  7876  7875  0 15:02 ?        00:00:00 nginx: worker process
www-data  7877  7875  0 15:02 ?        00:00:00 nginx: worker process
www-data  7878  7875  0 15:02 ?        00:00:00 nginx: worker process
www-data  7879  7875  0 15:02 ?        00:00:00 nginx: worker process
stephen   8321  3510  0 15:20 pts/0    00:00:00 grep --color=auto nginx
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

3.kill nginx进程

sudo kill  -9  7875 7876 7877 7879
 
 
  • 1
  • 1

4.全局查找与nginx相关的文件

sudo  find  /  -name  nginx*
 
 
  • 1
  • 1

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

sudo rm -rf file
 
 
  • 1
  • 1

这样就彻底删除nginx了

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值