linux徹底刪除nginx
原因:nginx無(wú)法啟動(dòng)了,配置出現(xiàn)問(wèn)題局蚀,因此卸載刪除配置后重裝
nginx重裝后啟動(dòng)成功
1.先執(zhí)行一下命令:
1.1 刪除nginx,–purge包括配置文件
sudo apt-get --purge remove nginx
1.2 自動(dòng)移除全部不使用的軟件包
sudo apt-get autoremove
1.3 羅列出與nginx相關(guān)的軟件
dpkg --get-selections|grep nginx
執(zhí)行1.3的結(jié)果:
dpkg --get-selections|grep nginx
nginx install
nginx-common install
nginx-full install
1.4 刪除1.3查詢(xún)出與nginx有關(guān)的軟件
sudo apt-get --purge remove nginx
sudo apt-get --purge remove nginx-common
sudo apt-get --purge remove nginx-full
這樣就可以完全卸載掉nginx包括配置文件
2.查看nginx正在運(yùn)行的進(jìn)程,如果有就kill掉
ps -ef |grep nginx
1.看下nginx還有沒(méi)有啟動(dòng),一般執(zhí)行完1后,nginx還是啟動(dòng)著的深纲,如下:
ps -ef |grep nginx
3.kill nginx進(jìn)程
sudo kill -9 進(jìn)程ID
4.全局查找與nginx相關(guān)的文件
sudo find / -name nginx*
5.依依刪除4列出的所有文件
sudo rm -rf file
這樣就徹底刪除nginx了
- 再次重裝
sudo apt-get update
sudo apt-get install nginx
7.安裝是否成功
sudo /etc/init.d/nginx start