Nginx and Apache - Nginix wont start due to mod_security

Brenden

Verified User
Joined
Oct 24, 2003
Messages
35
Hi All

Did anyone else experience this overnight?

Nginx stopped all 4 of my servers with mod_security errors. Commenting out the line and mod_security off fixed it
 
Hi All

Did anyone else experience this overnight?

Nginx stopped all 4 of my servers with mod_security errors. Commenting out the line and mod_security off fixed it

What was the error? Didn't ./build nginx help?
 
What ruleset are you using Comodo? If yes it’s not compatible with nginx
 
Sorry! The error is below. Yes, I was using Comodo - didn't realise it wasn't supported as it was working.

nginx[31780]: nginx: [emerg] "modsecurity_rules_file" directive Rules error. File: /usr/local/cwaf/>
nginx[31780]: nginx: configuration file /etc/nginx/nginx.conf test failed


Commenting out mod_security in /etc/nginx/nginx-modsecurity-enable.conf and reloading Nginx fixed it.
 
May you check if the problem is the same after "./build rewrite_confs"? If it solves the issue - may you try "./build nginx" after? If it doesn't - please try owasp ruleset.
 

modsecurity_ruleset - chooses ModSecurity Rule Set to install when "./build modsecurity_rules", "./build modsecurity", "./build apache", "./build nginx" or "./build all d" is ran. Set to 'no' to use no ruleset (or to use a custom one, uploaded to custom/modsecurity/conf directory. Comodo option provides Comodo Rule Set for ModSecurity: https://modsecurity.comodo.com/. OWASP ModSecurity Core Rule Set: https://www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Project. Add custom rules to custom/modsecurity/conf, they are added automatically to /etc/modsecurity.d after './build modsecurity' or './build modsecurity_ruleset' is ran. Nginx is not compatible with Comodo Rule Set yet. Possible values: comodo/owasp/no. (default: comodo).
 

modsecurity_ruleset - chooses ModSecurity Rule Set to install when "./build modsecurity_rules", "./build modsecurity", "./build apache", "./build nginx" or "./build all d" is ran. Set to 'no' to use no ruleset (or to use a custom one, uploaded to custom/modsecurity/conf directory. Comodo option provides Comodo Rule Set for ModSecurity: https://modsecurity.comodo.com/. OWASP ModSecurity Core Rule Set: https://www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Project. Add custom rules to custom/modsecurity/conf, they are added automatically to /etc/modsecurity.d after './build modsecurity' or './build modsecurity_ruleset' is ran. Nginx is not compatible with Comodo Rule Set yet. Possible values: comodo/owasp/no. (default: comodo).
Fixed! Thank you for the report :) They released a version compatible with nginx (I hope it still works fine).
 
Sorry! The error is below. Yes, I was using Comodo - didn't realise it wasn't supported as it was working.

nginx[31780]: nginx: [emerg] "modsecurity_rules_file" directive Rules error. File: /usr/local/cwaf/>
nginx[31780]: nginx: configuration file /etc/nginx/nginx.conf test failed


Commenting out mod_security in /etc/nginx/nginx-modsecurity-enable.conf and reloading Nginx fixed it.
We've got multiple reports like this, it seems to be Imunify ruleset related. I guess you're running Imunify as well?
 
Imunify team replied that they've fixed it in their last ruleset:
Code:
imunify360-agent update modsec-rules --force
 
Fixed! Thank you for the report :) They released a version compatible with nginx (I hope it still works fine).
So you can now use the standard comodo with the latest version of nginx? Great if that’s true.
 
In DA latest version 1.61.5, if I include options.conf before DA installation using these values:

Apache config:
#WEB Server Settings
webserver=nginx_apache
modsecurity=yes
modsecurity_ruleset=comodo

Then nginx couldn't be started with the error related to modsecurity directive but rebuilding nginx_apache again fixed this problem:

Code:
./build nginx_apache
 
In DA latest version 1.61.5, if I include options.conf before DA installation using these values:

Apache config:
#WEB Server Settings
webserver=nginx_apache
modsecurity=yes
modsecurity_ruleset=comodo

Then nginx couldn't be started with the error related to modsecurity directive but rebuilding nginx_apache again fixed this problem:

Code:
./build nginx_apache

I would like to confirm that this has been fixed in directadmin 1.62+. I don't have to rebuild anymore.
 
Back
Top