![安装 apache2 时出现问题](https://linux22.com/image/877837/%E5%AE%89%E8%A3%85%20apache2%20%E6%97%B6%E5%87%BA%E7%8E%B0%E9%97%AE%E9%A2%98.png)
如果我输入:
sudo apt-get install apache2
我得到:
Setting up apache2-bin (2.4.7-1ubuntu4.8) ...
Setting up apache2-data (2.4.7-1ubuntu4.8) ...
Setting up apache2 (2.4.7-1ubuntu4.8) ...
ERROR: Config file dir.conf not properly enabled: /etc/apache2/mods-enabled/dir.conf is a real file, not touching it
dpkg: error processing package apache2 (--configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
Errors were encountered while processing:
apache2
E: Sub-process /usr/bin/dpkg returned an error code (1)
输入:sudo apt-get install -f
输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up apache2 (2.4.7-1ubuntu4.8) ...
ERROR: Config file dir.conf not properly enabled: /etc/apache2/mods-enabled/dir.conf is a real file, not touching it
dpkg: error processing package apache2 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
apache2
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
如果您没有所需的任何 apache2 配置,请尝试通过删除所有 apache2 文件和配置并安装新的默认配置来解决此问题。
尝试以下命令来卸载并删除配置文件。
(您需要停止 apache 服务前您卸载):
sudo apt-get purge apache2*
然后输入以下命令再次安装:
apt-get install apache2