Nginx ModSecurity Not able to open file

On an Nginx server after updating Nginx and ModSecurity, I got the following error

[root@localhost ~]# nginx -t
nginx: [emerg] "modsecurity_rules_file" directive Rules error. File: /etc/nginx/modsecurity.conf. Line: 275. Column: 51. "/etc/nginx/coreruleset-3.3.2/rules/*.conf": Not able to open file. Looking at: '"/etc/nginx/coreruleset-3.3.2/rules/*.conf"', '"/etc/nginx/coreruleset-3.3.2/rules/*.conf"', '/etc/nginx/"/etc/nginx/coreruleset-3.3.2/rules/*.conf"', '/etc/nginx/"/etc/nginx/coreruleset-3.3.2/rules/*.conf"'. in /etc/nginx/conf.d/default.conf:5
nginx: configuration file /etc/nginx/nginx.conf test failed
[root@localhost ~]#

To fix the error, edit file

vi /etc/nginx/modsecurity.conf

Find

Advertisement

Include "/etc/nginx/coreruleset-3.3.2/rules/*.conf"

Replace with

Include /etc/nginx/coreruleset-3.3.2/rules/*.conf

Now restart Nginx, it will work.

systemctl restart nginx
Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement