comparison xml/en/docs/faq/variables_in_config.xml @ 196:aafe530e7d6f

- Added faq/ and more q&a as previously agreed
author Andrey Alexeev <andrew@nginx.com>
date Wed, 23 Nov 2011 15:32:04 +0000
parents
children ec4626d04879
comparison
equal deleted inserted replaced
195:e83a59eee5cf 196:aafe530e7d6f
1 <!DOCTYPE article SYSTEM "../../../dtd/article.dtd">
2
3 <article name="Is there a proper way to use nginx variables to
4 make sections of the configuration shorter,
5 using them as macros for making
6 parts of configuration work as templates?"
7 link="/en/docs/faq/variables_in_config.html"
8 lang="en">
9
10 <section>
11
12 <para>
13 <initial>Q:</initial>
14 Is there a proper way to use nginx variables to make sections of
15 the configuration shorter, using them as macros for making
16 parts of configuration work as templates?
17 </para>
18
19 <para>
20 &nbsp;
21 </para>
22
23 <para>
24 <initial>A:</initial>
25 Variables should not be used as template macros. Variables are
26 evaluated in the run-time during the processing of each
27 request, so they are rather costly compared to plain static
28 configuration. Using variables to store static strings is also
29 a bad idea. Instead, a macro expansion should be used to
30 generate configs more easily and it can be done with the
31 external tools, e.g. sed + make or any other common template
32 mechanism.
33 </para>
34
35 </section>
36
37 </article>