重新安装apache2时出错

我昨天在Debian Wheezy上进行了远程升级,并在syslog-nc-core上出现错误。 我发现我应该尝试重新安装它,并尝试,但它结束了apache2没有configuration的错误。 我清除它也当我现在尝试重新安装我得到的错误

Setting up apache2 (2.4.10-1) ... Directory /etc/apache2/conf.d is not empty - leaving as is Please note, that directory is considered obsolete and not read anymore by default zz010_psa_httpd.conf 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) 

如果你没有你需要的任何apache2configuration,解决这个问题的最简单的方法就是把它全部删除,让apt-get为你安装一个新的缺省configuration。 跑:

 apt-get purge apache2 rm -rf /etc/apache2 apt-get install apache2 

你说你清除了apache2,所以也许你已经跑了第一步,但显然有其他自定义文件仍然留在/ etc / apache2。 第二步将摆脱那些。

一旦你有一个新的默认apache2configuration,你可以开始定制它。

如果您现在需要/ etc / apache2中的某些configuration,最好的方法是先将其备份到其他位置,然后将其擦干净,然后重新启动,然后重新导入所需的部分。

请注意,在Debian的apache 2.4中,/ etc / apache2中的旧conf.d目录已被conf-available和conf-enabled目录取代,类似于mods-和sites-。 你用a2enconf / a2disconf来pipe理它们,就像a2enmod / a2dismod和a2ensite / a2dissite一样。