Welcome! Log In Create A New Profile

Advanced

Re: set variables within config

May 14, 2009 01:08PM
I do this, for fastcgi ports currently.

Igor says it is supported, but I am running into an issue and I can't
reproduce it yet but it is happening (today I actually have to fix it)

You can do this as long as the parameter you are using supports
variables. I am not sure if all of them do or not. The error_log might
not for example; not sure. Might be a nice thing to add to the wiki,
under the context it is accepted, whether or not it parses variables
too. (and perhaps parses captures?)

On Thu, May 14, 2009 at 9:59 AM, Jon Garvin <jgarvin.lists@gmail.com> wrote:
> 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
>
>
> --
>
> http://www.5valleys.com/
>
> http://www.workingwithrails.com/person/8078
>
>
>
Subject Author Posted

set variables within config

Jon Garvin May 14, 2009 12:59PM

Re: set variables within config

mike May 14, 2009 01:08PM

Re: set variables within config

Maxim Dounin May 14, 2009 03:32PM

Re: set variables within config

Jon Garvin May 14, 2009 04:16PM

Re: set variables within config

mike May 14, 2009 04:39PM

Re: set variables within config

Cliff Wells May 14, 2009 05:01PM

Re: set variables within config

mike May 14, 2009 05:14PM

Re: set variables within config

Dave Bailey May 14, 2009 05:46PM

Re: set variables within config

Igor Sysoev May 15, 2009 01:17AM

Re: set variables within config

mike May 15, 2009 01:32AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 143
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready