14 messages in ru.sysoev.nginxRe: Is it possible to have a loop in ...
FromSent OnAttachments
mobi...@public.gmane.orgJan 30, 2008 3:55 pm 
Cliff WellsJan 30, 2008 4:03 pm 
Casey RaymanJan 30, 2008 4:06 pm 
mobi...@public.gmane.orgJan 30, 2008 4:07 pm 
mobi...@public.gmane.orgJan 30, 2008 4:10 pm 
Eden LiJan 30, 2008 4:52 pm 
mobi...@public.gmane.orgJan 30, 2008 5:56 pm 
mobi...@public.gmane.orgJan 30, 2008 6:19 pm 
Casey RaymanJan 30, 2008 7:43 pm 
Igor SysoevJan 30, 2008 10:04 pm 
Grzegorz NosekJan 31, 2008 12:08 am 
ThomasJan 31, 2008 1:46 am 
Mike LottJan 31, 2008 3:47 am 
ThomasJan 31, 2008 4:31 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Is it possible to have a loop in config?Actions...
From:Casey Rayman (case@public.gmane.org)
Date:Jan 30, 2008 7:43:53 pm
List:ru.sysoev.nginx

Yeah. Currently doing it with a shell script, but was curious if there was a "righter" way. Thanks for the help.

Thanks, Casey

On Jan 30, 2008, at 6:52 PM, Eden Li wrote:

afaik, no. but you can easily hack ERB or some other templating system into your deployment process.

ruby -rerb -e 'puts ERB.new(IO.read("nginx.rconf")).result' > nginx.conf

then you could do stuff like:

<% [10, 20, 99].each do |port| %> server { listen <%= port %>; ... } <% end %>

mucho ugly, but it makes things shorter :)

On Jan 31, 2008 8:06 AM, Casey Rayman
<casey.rayman-Lx+odIY@public.gmane.org> wrote:

I'm using nginx as a reverse proxy and so I've got several sites which use exactly the same config with the exception of the port. Is there a way to do something like....

array {10,20,99}

for each i in array { server { listen $i; ... } }

Perhaps an odd question, but nginx has all kinds of useful features I'd never thought of before.