Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What I want to do is guard against configuration segments with invalid directives being run in an nginx that doesn't have the proper module installed. Something like the IfModule directive in Apache ( Does anything similar exist in nginx?

share|improve this question
Why not just do nginx -t to check the syntax before restarting nginx? – ceejayoz Jun 4 '13 at 19:17
To clarify, this is in order to ship config files which, if loaded in the absence of certain modules, won't make an end-user's nginx barf. To take the onus off of them to double-check settings when loading a provided config file. If certain module is missing, then no-op. – dkuebric Feb 5 '14 at 15:19
up vote 1 down vote accepted

Apache's <IfModule> applies a set of directives if the specific module is loaded.

Since Nginx does not support dynamic module loading, this feature is not available.


share|improve this answer
this was my fear – dkuebric Feb 5 '14 at 15:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.