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

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

Back to Install Nginx ModSecurity on CentOS 7

Comments

Leave a Reply

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