Installing mod_security causing apache service start to fail

apache-2.2mod-security

I installed mod security using this tutorial http://www.linuxmaza…. . After installing I got the error described and followed the steps to solve it. The only thing I did differently was updating apache from the repo rather than uninstalling first.

Apache fails on restart, the error log tell me this :

Update: I uninstalled apache and did a clean install. Still getting the same error though.

[Mon Feb 20 16:45:24 2012] [notice] caught SIGTERM, shutting down
[Mon Feb 20 16:45:35 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Feb 20 16:45:35 2012] [alert] (EAI 2)Name or service not known: mod_unique_id:    unable to find IPv4 address of "astinf"
Configuration Failed

Best Answer

A bit of Googling on that error suggests that you have astinf (I'm guessing this is your username...) in your Apache config for the ServerName directive.

You can either change your ServerName to something that will return an IP address (such as localhost) or add an entry for whatever you have in there into your /etc/hosts file.

If you have problems with that, this answer suggests that SELinux can get in the way of Apache reading your /etc/hosts file.