ubuntu16.04徹底刪除nginx+php


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

sudo apt-get --purge remove nginx

1.2 自動移除全部不使用的軟件包

sudo apt-get autoremove

1.3 羅列出與nginx相關的軟件

dpkg --get-selections|grep nginx
執行1.3的結果: stephen@stephen-OptiPlex-390:~$ dpkg --get-selections|grep nginx nginx install nginx-common install nginx-core install

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

這樣就可以完全卸載掉nginx包括配置文件

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

ps -ef |grep nginx

看下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

kill nginx進程

sudo kill -9 7875 7876 7877 7879

4.全局查找與nginx相關的文件

sudo find / -name nginx*

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

sudo rm -rf file

這樣就徹底刪除nginx了

6. 再次重裝

sudo apt-get update sudo apt-get install nginx

三、卸載刪除php
 
sudo apt-get –purge remove libapache2-mod-php5 php5 php5-gd php5-mysql
sudo apt-get autoremove php5
 
刪除關聯,
sudo find /etc -name "*php*" |xargs  rm -rf 
 
清楚殘留信息
dpkg -l |grep ^rc|awk ’{print $2}’ |sudo xargs dpkg -P
 
最后用 dpkg -l | grep php 和dpkg -l | grep php5 檢查,如無返回即干凈卸載
徹底刪除php
sudo apt-get –purge remove libapache2-mod-php5 php5 php5-gd php5-mysql

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM