Is it possible to have a loop in config?
Eden Li
eden at mojiti.com
Thu Jan 31 03:52:30 MSK 2008
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 at d2sc.com> 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.
>
> Casey
>
>
More information about the nginx
mailing list