Nginx ModSecurity Not able to open file
On an Nginx server after updating Nginx and ModSecurity, I got the following error
1 2 3 4 |
[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
1 |
vi /etc/nginx/modsecurity.conf |
Find
1 |
Include "/etc/nginx/coreruleset-3.3.2/rules/*.conf" |
Replace with
1 |
Include /etc/nginx/coreruleset-3.3.2/rules/*.conf |
Now restart Nginx, it will work.
1 |
systemctl restart nginx |