Giter Site home page Giter Site logo

Comments (7)

AnoopAlias avatar AnoopAlias commented on July 24, 2024

modsecurity_rules_file is valid in the server context too (but the doc says to put it in location context).
I had put it in 2 locations per server. Now i removed it and put it outside location block (only once per server in this case )

Even now nginx -t is consuming a lot of time to finish. I guess it needs to loop through all the crs file for each server?.

Following is the time taken for 36 domains in a 2 GB KVM vps

# time nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

real	0m23.287s
user	0m22.147s
sys	0m0.863s

I am sure this will be almost on a very big scale for servers hosting 500+ domains.

from modsecurity-nginx.

zimmerle avatar zimmerle commented on July 24, 2024

Hi @AnoopAlias,

any reason why not to use the configuration in the global (http) section ?

from modsecurity-nginx.

AnoopAlias avatar AnoopAlias commented on July 24, 2024

@zimmerle - Ok putting this in the http context works. I was just following the docs which mention about putting the rules file in location context.

So I guess the best way to do this put

modsecurity on;
modsecurity_rules_file /etc/nginx/conf.d/zz_modsecurity.conf;

in the http context and for vhost's that dont need mod_sec put

modsecurity off;
in the server section
?

from modsecurity-nginx.

zimmerle avatar zimmerle commented on July 24, 2024

That would be a good idea :)

Tell me if you face any problems.

from modsecurity-nginx.

intelbg avatar intelbg commented on July 24, 2024

@zimmerle I have the same problem here. Stopped the groups, increased sh.min and sh.memmax in /etc/sysctl.conf but nginx does not start again. I use mosecurity on in the server { block, but not in http because I don't want modsec to be turned for all customers, every customer has a user.conf.

from modsecurity-nginx.

AnoopAlias avatar AnoopAlias commented on July 24, 2024

@intelbg - if you set modsecurity off; in the server {} context it dosnt work for the vhost ,so is fine.

from modsecurity-nginx.

intelbg avatar intelbg commented on July 24, 2024

@AnoopAlias the problem exists even if mod security directive is not present on the vhosts. I created another post for that - even when modsec does not work work for the vhosts , only compiled in the nginx binary it has memory allocation problems and servers loads on 150+ immediately after nginx configtest or restart. Without modsec there isn't a problems.

from modsecurity-nginx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.