Configuration Primer

Gavin Kistner phrogz at mac.com
Fri Feb 20 09:09:00 MSK 2009


Does there exist an english introduction to NginX config 'programming'?

I have found various example configurations, both simplistic and 'full  
featured'.

I have found the list of modules on the wiki, and the command-centric  
documentation they supply. (Though I wish even this were more in- 
depth. For example, what is the regex syntax allowed for the rewrite  
command? PCRE? Posix classes? Lookaheads/lookbehinds?)

What I'm missing is an overview of how configurations really work.  
With the ability to set variables, scoping, break directives and  
rewrite commands like last/break/redirect/permanent, it's more like a  
programming language than a set of parameters. Various questions this  
has raised in my mind regarding the sort of information I'm looking for:
What is the 'flow' of execution?
When you 'break', what scope/context are you stopping the directives in?
When all is said and done, what is being returned?
Can I chain multiple rewrites? Does a rewrite affect all kinds of  
later matches (e.g. 'if' or 'location')?

While answers to the above specific questions would almost certainly  
help me string a few islands of knowledge together, I'm hoping someone  
knows of a guide already written. Something that starts at NginX  
Config Theory 101 (not super-simple examples, but instead something  
like stepping through the procedure of matching a request against a  
config file from start to finish) and then covers things like Virtual  
Hosts and Virtual Directories and so on.

Any chance it exists?





More information about the nginx mailing list