You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Bill Moseley <mo...@hank.org> on 2006/10/30 17:24:02 UTC

[users@httpd] variable substitution in httpd.conf

Bad subject, but I normally generate my httpd.conf files via a
templating system so this isn't an issue, but yesterday I was working
on a config that listened on multiple IP addresses for name-based
virtual hosting.  That is:

    Listen 1.1.1.1:80
    Listen 1.1.1.2:80

    NameVirtualhost 1.1.1.1:80
    <VirtualHost 1.1.1.1:80>
        ServerName foo
    </VirtualHost>

    <VirtualHost 1.1.1.1:80>
        ServerName bar
    </VirtualHost>

    NameVirtualhost 1.1.1.2:80
    <VirtualHost 1.1.1.2:80>
        ServerName foo
    </VirtualHost>

    <VirtualHost 1.1.1.2:80>
        ServerName bar
    </VirtualHost>

I was wondering if there is a way to write that symbolically as I do
when using a templating system to build httpd.conf?

The reason this came up is I was moving to new IP addresses and was
wondering why I was typing the same value in more than one place.

That is:

    address_1 = 1.1.1.1:80
    address_2 = 1.1.1.2:80

    Listen address_2
    Listen address_2


    NameVirtualaddress_ address_1
    <Virtualaddress_ address_1>
        ServerName foo
    </Virtualaddress_>

    <Virtualaddress_ address_1>
        ServerName bar
    </Virtualaddress_>

    NameVirtualaddress_ address_2
    <Virtualaddress_ address_2>
        ServerName foo
    </Virtualaddress_>

    <Virtualaddress_ address_2>
        ServerName bar
    </Virtualaddress_>


-- 
Bill Moseley
moseley@hank.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] variable substitution in httpd.conf

Posted by Nick Kew <ni...@webthing.com>.
On Mon, 30 Oct 2006 08:24:02 -0800
Bill Moseley <mo...@hank.org> wrote:


> I was wondering if there is a way to write that symbolically as I do
> when using a templating system to build httpd.conf?

mod_macro

-- 
Nick Kew

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] variable substitution in httpd.conf

Posted by "Neil A. Hillard" <ne...@agustawestland.com>.
Hi,

Bill Moseley wrote:
> Bad subject, but I normally generate my httpd.conf files via a
> templating system so this isn't an issue, but yesterday I was working
> on a config that listened on multiple IP addresses for name-based
> virtual hosting.  That is:
> 
>     Listen 1.1.1.1:80
>     Listen 1.1.1.2:80
> 
>     NameVirtualhost 1.1.1.1:80
>     <VirtualHost 1.1.1.1:80>
>         ServerName foo
>     </VirtualHost>
> 
>     <VirtualHost 1.1.1.1:80>
>         ServerName bar
>     </VirtualHost>
> 
>     NameVirtualhost 1.1.1.2:80
>     <VirtualHost 1.1.1.2:80>
>         ServerName foo
>     </VirtualHost>
> 
>     <VirtualHost 1.1.1.2:80>
>         ServerName bar
>     </VirtualHost>
> 
> I was wondering if there is a way to write that symbolically as I do
> when using a templating system to build httpd.conf?
> 
> The reason this came up is I was moving to new IP addresses and was
> wondering why I was typing the same value in more than one place.
> 
> That is:
> 
>     address_1 = 1.1.1.1:80
>     address_2 = 1.1.1.2:80
> 
>     Listen address_2
>     Listen address_2
> 
> 
>     NameVirtualaddress_ address_1
>     <Virtualaddress_ address_1>
>         ServerName foo
>     </Virtualaddress_>
> 
>     <Virtualaddress_ address_1>
>         ServerName bar
>     </Virtualaddress_>
> 
>     NameVirtualaddress_ address_2
>     <Virtualaddress_ address_2>
>         ServerName foo
>     </Virtualaddress_>
> 
>     <Virtualaddress_ address_2>
>         ServerName bar
>     </Virtualaddress_>

You could always try:

    Listen 1.1.1.1:80
    Listen 1.1.1.2:80

    NameVirtualhost 1.1.1.1:80
    NameVirtualhost 1.1.1.2:80

    <VirtualHost 1.1.1.1:80 1.1.1.2:80>
        ServerName foo
    </VirtualHost>

    <VirtualHost 1.1.1.1:80 1.1.1.2:80>
        ServerName bar
    </VirtualHost>

HTH,


				Neil.

-- 
Neil Hillard                    neil.hillard@agustawestland.com
AgustaWestland                  http://www.whl.co.uk/

Disclaimer: This message does not necessarily reflect the
            views of Westland Helicopters Ltd.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org