We earn commission when you buy through affiliate links.
This does not influence our reviews or recommendations.Learn more.
Nginx web server is used on more than30%of website worldwide and growing.
Nginx is well-known for its performance and lightweight web server/proxy and used on many busiest sites.
Mod Security is an Open Source WAF by Trustwave SpiderLabs and was made available for Nginx in 2012.
In this guide, Ill explain how todownload,installandconfigureMod Security with Nginx.
If you are new to Nginx then I would recommend taking thisfundamental course.
Note:if you are doing on a brand new server then you may need to install following libraries.
First, lets compile mod security.
Go tomodsecurity-2.9.1folder and use below commands.
You may also use thefindcommand.
Lets renamemodsecurity.conf-recommendedtomodsecurity.conf
So it should appear like this
Now, Mod Security is integrated with Nginx.
Restart the Nginx to ensure its coming up without any error.
There are two possible methods to confirm Nginx is compiled with Mod Security.
List the compiled module by using V with nginx executable file.