Legacy Knowledge Base
Published Jun. 30, 2025

Unable to activate ModSecurity

Written By

Jose L. Bango

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.
Note: please note that Liferay has renamed its Liferay Experience Could offerings to Liferay SaaS (formerly LXC) and Liferay PaaS (formerly LXC-SM).

Issue

  • When trying to activate ModSecurity or add new rules following the official documentation, it doesn't work.
  • The debug log is turned on but it doesn't print anything.

Environment

  • Liferay PaaS

Resolution

  • First of all, double check that you have properly configured LCP_WEBSERVER_MODSECURITY environment variable in webserver/LCP.json.
  • Apart from the audit log (/var/log/modsec_audit.log), try to turn on the debug log in modsecurity.conf:
    SecDebugLog /var/log/modsec_debug.log
    SecDebugLogLevel 9
  • If, despite that, nothing is printed in modsec_audit.log or modsec_debug.log that helps you troubleshoot the issue, you may see something like this in Nginx logs:
    2023/12/04 18:31:53 [emerg] 83#83: "modsecurity_rules_file" directive Rules error. File: /etc/nginx/modsec/modsecurity.conf. Line: 194. Column: 16. Failed to start DebugLog: Failed to open file: /opt/modsecurity/var/log/debug.log in /etc/nginx/nginx.conf:62
    nginx: [emerg] "modsecurity_rules_file" directive Rules error. File: /etc/nginx/modsec/modsecurity.conf. Line: 194. Column: 16. Failed to start DebugLog: Failed to open file: /opt/modsecurity/var/log/debug.log in /etc/nginx/nginx.conf:62
  • Even if this is not your case, double check your own nginx.conf. You may have some directives that conflict with your ModSecurity configuration, such as modsecurity off;.

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base