If I enter:

sudo apt-get install apache2

I get:

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)

input: sudo apt-get install -f

output: 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)

  • sudo a2dismod dir; sudo apt-get install -f Add the output to your question. – A.B. Nov 27 '15 at 18:13
  • input: sudo a2dismod dir; output: Disabling stale config file dir.conf. ERROR: /etc/apache2/mods-enabled/dir.conf is not a symbolic link, not deleting – user3682961 Nov 27 '15 at 18:52
  • -rw-r--r-- 1 root root 157 জানু 3 2014 /etc/apache2/mods-available/dir.conf -rw-r--r-- 1 root root 58 জানু 3 2014 /etc/apache2/mods-available/dir.load – user3682961 Nov 27 '15 at 18:55
  • output: -rw-r--r-- 1 root root 117 নভে 27 10:16 /etc/apache2/mods-enabled/dir.conf -rw-r--r-- 1 root root 117 নভে 27 10:16 /etc/apache2/mods-enabled/dir.conf~ -rw------- 1 root root 1 নভে 27 10:10 /etc/apache2/mods-enabled/dir.conf.save -rw-r--r-- 1 root root 117 নভে 27 10:28 /etc/apache2/mods-enabled/dir.conf.save.1 – user3682961 Nov 27 '15 at 18:59
  • rm: cannot remove ‘/etc/apache2/mods-enabled/dir.*’: No such file or directory – user3682961 Nov 27 '15 at 19:04
up vote 1 down vote accepted

If you don't have any apache2 configuration that you need, Try to resolve this by removing all apache2 files and configuration and install a new default configuration.

Try the following command to uninstall and remove configuration files.

(You need to stop the apache service before you uninstall):

sudo apt-get purge apache2*

And install it again by typing:

apt-get install apache2
  • And all configurations? Sure not. – A.B. Nov 27 '15 at 18:13
  • Thanks brother it works, i was trying this for more than 5 hours. I am really thankful to you. Could you help to rate this. or marked it solved. i am using ubuntu just for 2 days. – user3682961 Nov 27 '15 at 19:11

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.