lol<br><br><div class="gmail_quote">2010/10/22 Arthur Blake <span dir="ltr">&lt;<a href="mailto:arthur.blake@gmail.com">arthur.blake@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>It seems like the set command was designed for use in a narrow set of circumstances.  But I think it would be a lot more useful if the variables it defines could be used globally with any directive.</div><div><br></div>

I am trying to use the &#39;set&#39; command in order to define my own variables that define things that may vary by server in a main nginx.conf file so that a generic reusable include file can later use those variables.  It seems that the variables only work in certain places with certain directives.<div>

<br></div><div>Is there a reason I can&#39;t use variables set this way more widely?  I would like to be able to use variables like this anywhere in the config files.</div><div><br></div><div><div>In the example below, I define two variables with the &#39;set&#39; command, $rootfolder and $backend.</div>

<div><br></div><div>The $rootfolder variable doesn&#39;t work with the include directive and the $backend doesn&#39;t work with the proxy_pass directive.</div><div>But the $rootfolder does work with the $alias directive.</div>

</div><div><br></div><div>#main nginx.conf</div><div>server</div><div>{</div><div>  listen 80;</div><div>  server_name www.justatest.xxx</div><div>  set $rootfolder /Development</div><div>  set $backend <a href="http://127.0.0.1:8080" target="_blank">http://127.0.0.1:8080</a></div>

<div>  # This doesn&#39;t work!</div><div>  # include $rootfolder/mytest/vhost.conf;</div><div>  # have to use this instead</div><div>  include /Development/mytest/vhost.conf;</div><div>}</div><div><br></div><div><br></div>

<div>#vhost.conf include</div><div><br></div><div><div>location / </div><div>{</div><div>  proxy_set_header X-Forwarded-Host $host;</div><div>  proxy_set_header X-Forwarded-Server $host;</div><div>  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;</div>

<div>  proxy_set_header X-Rewrite-URL $request_uri;</div><div>  # this doesn&#39;t work!</div><div>  # proxy_pass $backend;</div><div>  # have to use this instead</div><div>  proxy_pass <a href="http://127.0.0.1:8080" target="_blank">http://127.0.0.1:8080</a>;</div>

<div>}</div><div><br></div><div>location /resources/</div><div>{</div><div>  # this DOES work</div><div>  alias $websites/www/resources/;</div><div>}</div></div><div><br></div><div><br></div><div>--Thanks</div>
<br>_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Pozdrawiam Admin sieci WidNet(<a href="http://widnet.eu/">http://widnet.eu/</a>)<br>