以下命令都在root用户权限下执行
1 删除nginx,–purge包括配置文件
apt-get --purge remove nginx
2 自动移除全部不使用的软件包
apt-get autoremove
3 罗列出与nginx相关的软件
dpkg --get-selections|grep nginx
4 删除上一步查询出与nginx有关的软件
apt-get --purge remove nginx
apt-get --purge remove nginx-common
apt-get --purge remove nginx-core
5 查看nginx正在运行的进程,如果有就kill掉
ps -ef |grep nginx
6 kill nginx进程
kill -9 7875 7876 7877 7879
7 全局查找与nginx相关的文件
find / -name nginx*
8 依次删除上一步列出的所有文件
rm -rf file
9 再次重装
apt-get update
apt-get install nginx