卸载Ubuntu10.04默认安装的apache2

  搭建postgreSQL+Nginx+php的环境后,重启Nginx的时候发现80端口被占用。通过查看端口占用情况,发现apache2占用了80端口,于是kill 掉apache2进程,但奇怪的是,杀掉一个apache2 进程后,会再出现一个apache2进程,进程号递增。

  root@ubuntu:/home/onmyway/php-5.4.12# netstat -anpt | grep 80
  tcp        0      0 127.0.0.1:50505         0.0.0.0:*               LISTEN      1800/prosvc
  tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      12752/apache2

  

  root@ubuntu:/home/onmyway/php-5.4.12# kill -9 12752
  root@ubuntu:/home/onmyway/php-5.4.12# netstat -anpt | grep 80
  tcp        0      0 127.0.0.1:50505         0.0.0.0:*               LISTEN      1800/prosvc
  tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      12753/apache2

  我记得并没有安装过apache,原来Ubuntu10.04默认安装了apache。于是apt-get remove apache,但是提示没有安装apache。如下:

  root@ubuntu:/home/onmyway/php-5.4.12# apt-get remove apache2
  Reading package lists... Done
  Building dependency tree
  Reading state information... Done
  Package apache2 is not installed, so not removed
  0 upgraded, 0 newly installed, 0 to remove and 278 not upgraded.

  于是继续百度...抱着尝试的念头,先执行下面这一步:

  # apt-get remove apache2.2-common

  可以执行。但是发现系统中仍然有apache相关文件,并且进程还在。于是又去执行 apapt-get remove apache2

  这次提示信息不一样了!!!

  root@ubuntu:/home/onmyway/php-5.4.12# apt-get remove apache2
  Reading package lists... Done
  Building dependency tree
  Reading state information... Done
  Package apache2 is not installed, so not removed
  The following packages were automatically installed and are no longer required:
      apache2-utils libaprutil1-dbd-sqlite3 apache2.2-bin libaprutil1-ldap
  Use 'apt-get autoremove' to remove them.
  0 upgraded, 0 newly installed, 0 to remove and 276 not upgraded.

  还等什么,马上执行这条命令!
  root@ubuntu:/home/onmyway/php-5.4.12# apt-get autoremove

  执行完这条命令,再查看端口占用情况,发现80端口仍然被apache2进程占用,并且相关文件仍然还在。再执行一次apt-get autoremove,再查看,还是被占用。

  于是使用了一直想用的办法,reboot

  reboot后查看80端口,占用进程是Nginx!!!

  所以,到头来,我也不知道怎么就可以了...

posted @ 2013-04-27 00:35  hong&&hong  阅读(383)  评论(0编辑  收藏  举报