I have a server running ubuntu 14 lamp

I´ve installed mod_security:

apt-get install libapache2-modsecurity

then decided to uninstall using this command:

sudo apt-get remove libapache2-modsecurity

Then deleted manually (ftp) some files and folders like the log file, the folder: /usr/share/modsecurity-crs and the conf and load files on the apache mods enabled and available

Then decided to install again mod_security for

sudo apt-get remove libapache2-modsecurity

but now the log file is not created and the /usr/share/modsecurity-crs folder is not created either.

Is there any way to solve this?


The reason that you are having that issue, is because libapache2-modsecurity doesn't include in its list, the files you have removed so in order to make them appear again you have to reinstall recommended package modsecurity-crs, which is probably installed right now so you can reinstall it using the following command.

# apt-get install --reinstall modsecurity-crs

Next time in order to have a clue about the file list of a package, you can check online through http://packages.ubuntu.com/trusty/all/modsecurity-crs/filelist or using dpkg tool if the package is installed.

$ dpkg -L modsecurity-crs
  • All right! I thought that the rules came with the package at installation. I´m following this tutorial: digitalocean.com/community/tutorials/… right at the beginning, after running the install command and after running the command yu provided (which actually adds the rules folder and apparently the log file) they tell to run this command: apachectl -M | grep --color security and the response should be security2_module (shared) if the module was loaded but I don´t get this response... Any idea? – Frederico Lopes Sep 1 '15 at 18:18
  • Please before any step try to find out what the commands are actually do through manual(man). You haven't loaded the module, apachectl -M shows you the running modules that apache actually has started. Did you restart apache? – shad0VV Sep 1 '15 at 18:53
  • Yes, I restarted apache. Thank you for your help. I´ve recovered an image and I´m just finishing to update it with the latest db and www folder files, will back it up now and start all over trying to install mod_security. The first time I could install it, just did´t understood well how to create the symlinks, this is why I decided to remove the module to start again... Thank you very much for your answers, you´ve been a great help, thanks. – Frederico Lopes Sep 1 '15 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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