彻底删除linux下的apache2

问题描述 投票:0回答:3

我在 ubuntu 下删除 apache2 时遇到问题。我尝试的是:

sudo apt-get remove apache2
sudo apt-get purge apache2

不幸的是,在执行任何上面的命令之后,仍然有文件:

sudo find / -name "apache2"
/var/log/apache2
/var/lib/update-rc.d/apache2
/var/cache/apache2
/usr/share/doc/apache2.2-common/examples/apache2
/usr/share/apache2
/usr/lib/apache2
/usr/lib/apache2/mpm-event/apache2
/usr/lib/apache2/mpm-itk/apache2
/usr/lib/apache2/mpm-worker/apache2
/usr/lib/apache2/mpm-prefork/apache2
/usr/sbin/apache2
/run/apache2
/run/lock/apache2
/etc/init.d/apache2
/etc/apache2
/etc/cron.daily/apache2
/etc/default/apache2
/etc/logrotate.d/apache2

当我跑步时

sudo /etc/init.d/apache2 start

 * Starting web server apache2                                                                                                                                                                            apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.

在浏览器中输入 localhost 后,它会响应:

Forbidden

You don't have permission to access / on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

这个文件会干扰新的 apache 服务器安装吗?我已经检查了所有这些,但没有发现任何有趣的东西。

编辑: 上面的输出是移除服务器后的结果。从

sudo find / -name "apache2"
删除所有文件后,我再次安装了
sudo apt-get install apache2
sudo /etc/init.d/apache2
输出:

 * Starting web server apache2                                                                                                                                                                            Segmentation fault
Action 'start' failed.
The Apache error log may have more information.

但是error.log和access.log都是空的。

Apache 安装:

sudo apt-get install apache2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  apache2-mpm-worker apache2-utils apache2.2-common
Suggested packages:
  apache2-doc apache2-suexec apache2-suexec-custom
The following NEW packages will be installed:
  apache2 apache2-mpm-worker apache2-utils apache2.2-common
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/321 kB of archives.
After this operation, 1,240 kB of additional disk space will be used.
Do you want to continue [Y/n]? 

只需要

1,240 kB
空间,这正常吗?

php linux apache unix lamp
3个回答
6
投票

首先停止apache:

sudo service apache2 stop

然后,删除 apache2 软件包和依赖项:

sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove --purge

如果您手动修改或安装了某些内容,apt 可能无法将其删除。检查还剩下什么:

whereis apache2

看看这些目录里面有什么,如果你确定要扔掉它,请手动删除这些目录,如下所示:

sudo rm -Rf /etc/apache2 /usr/lib/apache2 /usr/include/apache2

0
投票

enter image description here 在此处查看错误图像

从 Ubuntu 中删除 apache2

从您的 localhost

完全删除

首先使用

检查当前状态
service apache2 status

如果它是 活动(正在运行) 接下来写

sudo apt remove apache2*

使用 y

说“是”

祝你有美好的一天:)


0
投票

对于 Ubuntu,这些命令将完全删除 Apache2、其所有配置、日志和 www 文件。

警告

sudo rm -rf /var/www/html
将删除您的
/var/www/html
目录中的所有文件,请确保那里没有任何重要的文件!!!

sudo service apache2 stop
sudo apt purge apache2
sudo apt purge apache2-utils
sudo apt autoremove
sudo rm -rf /var/lib/apache2
sudo rm -rf /etc/apache2
sudo rm -rf /var/www/html
sudo rm -rf /var/log/apache2
© www.soinside.com 2019 - 2024. All rights reserved.