This project provides a script to build and install Nginx with ModSecurity v3, the ModSecurity-nginx connector, and the OWASP Core Rule Set (CRS).
By default, the following versions will be installed:
- Nginx: v1.29.1
- ModSecurity: v3.0.14
- ModSecurity-nginx: v1.0.4
- OWASP CRS: v3.2.0
-
Ensure that Nginx is not currently installed.
If it is, back up your configuration files and remove the/etc/nginxdirectory and existing Nginx executable. -
Review the configuration templates provided in this repository:
modsec.main.confnginx.confnginx.service
You can modify these files, but do not rename them.
git clone https://github.com/JustDaile/bootstrap-nginx-modsec.git
cd bootstrap-nginx-modsec
chmod +x nginx-modsec-setup.shRun the setup script:
./nginx-modsec-setup.shOptional flags are available. To see them, run:
./nginx-modsec-setup.sh --helpNote: Compiling ModSecurity from source may take ~10 minutes depending on your system.
Don’t worry if it seems stuck at Compiling and installing ModSecurity.