/
/
Error «unknown directive modsecurity» when enabling WAF

Error «unknown directive modsecurity» when enabling WAF

Symptoms

Enabling WAF for a website results in an error:

An error occurred while working with the websites. An attempt to test configuration of the web-server while saving the file ""; failed: nginx: [emerg] unknown directive 'modsecurity' in /etc/nginx/vhosts/modsec_36P13O/modsecpmGFVG.conf:2 nginx: configuration file /etc/nginx/nginx.conf test failed

Causes

The directory with Nginx modules is not included in the configuration.

Solution

Add the following line into the Nginx configuration file at /etc/nginx/nginx.conf:

include /etc/nginx/modules-enabled/*.conf;

In this article