<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=us-ascii" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Maxim Dounin wrote:
<blockquote cite="mid:20090514193247.GE27758@mdounin.ru" type="cite">
  <pre wrap="">On Thu, May 14, 2009 at 10:59:26AM -0600, Jon Garvin wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">I haven't seen any way to do this in the docs, so this might be more of
a feature request, but if someone knows of a way to accomplish this that
I missed, let me know.

I'd really like to be able to set a variable in the config and then use
it to set other settings, with the ultimate goal of DRYing up the config
file.  For instance, right now I've got many different 'server' blocks,
each with a few lines that look like...

root /var/www/domain1/current/public;
access_log  /var/www/domain1/shared/log/nginx.access.log;
error_log  /var/www/domain1/shared/log/nginx.error.log;

Lots of repetition there.  Would be great if instead I could say...

$basepath = /var/www/domain1
root $basepath/current/public;
access_log  $basepath/shared/log/nginx.access.log;
error_log  $basepath/shared/log/nginx.error.log;

And then even better to be able th extract out those last three lines
into a paths.conf file (or something), so that each server block could
just say...

$basepath = /var/www/domain#
include paths.conf
    </pre>
  </blockquote>
  <pre wrap=""><!---->
As of now nginx has no variables expanded during config loading - 
everything expaneded during request processing.  So using 
variables just to save some config lines is somewhat stupid as it 
means wasting lots of CPU time for every request.

If you really need to simplify configs - it's easy to generate 
them using make and sed.

Maxim Dounin
  </pre>
</blockquote>
Well, then that sounds like a great candidate for an Nginx enhancement
at some point in the future.<br>
<br>
<br>
<pre class="moz-signature" cols="72">-- 

<a class="moz-txt-link-freetext" href="http://www.5valleys.com/">http://www.5valleys.com/</a>

<a class="moz-txt-link-freetext" href="http://www.workingwithrails.com/person/8078">http://www.workingwithrails.com/person/8078</a>
</pre>
</body>
</html>