You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Alfonsas Stonis <al...@gmail.com> on 2009/04/20 07:37:17 UTC

[users@httpd] How to define constant in apache configuration?

Hi,

I want to define constant that I will use latter in several places.
Old documentation says that there was Define statement (or similar)

Define myUrl "ldap://localhost"
...
AuthLDAPUrl $myUrl

However, there is nothing in current documentation (I was not able to
find the same or similar module).

Can you tell me how to do it with apache2?

I tried to search on web, but found only dozens of the same question
(no answers). I tried:

SetEnv myUrl "ldap://localhost"
...
AuthLDAPUrl $myUrl

Did not worked too.

Thanks,
Alfas

Re: [users@httpd] How to define constant in apache configuration?

Posted by Doug Bell <do...@plainblack.com>.
On Apr 20, 2009, at 8:23 PM, Alfonsas Stonis wrote:

> 2009/4/20 Krist van Besien <kr...@gmail.com>
>>
>> On Mon, Apr 20, 2009 at 7:37 AM, Alfonsas Stonis
>> <al...@gmail.com> wrote:
>>> Hi,
>>>
>>> I want to define constant that I will use latter in several places.
>>> Old documentation says that there was Define statement (or similar)
>>>
>>> Define myUrl "ldap://localhost"
>>> ...
>>> AuthLDAPUrl $myUrl
>>
>> I don't think that there was ever, in any version of Apache, a way to
>> do what you describe above.
>>
>>> However, there is nothing in current documentation (I was not able  
>>> to
>>> find the same or similar module).
>>>
>>> Can you tell me how to do it with apache2?
>>>
>>> I tried to search on web, but found only dozens of the same question
>>> (no answers). I tried:
>>>
>>> SetEnv myUrl "ldap://localhost"
>>> ...
>>> AuthLDAPUrl $myUrl
>>>
>>> Did not worked too.
>>
>> You can't do this in Apache. You could try using mod_perl, which
>> allows you to use perl statements in an apache config. But do you
>> really want this amount of complexity?
>>
>> Krist
>>
> I can not find now the definition, but there was some module for
> apache 1.3 (maybe it was third party) that allowed to write define.
> However, I found hard to believe that such basic thing would not be
> supported in apache 2 configuration. There should be some easy way to
> do this.
>

This is a configuration file, not a programming language. If you want,  
you can use Include to mimic the functionality.

Make a file with all the LDAP stuff you want, and then

Include conf/ldap.conf

In all the places you want the LDAP stuff to appear.

If this is unacceptable, then use mod_perl as was suggested before.

Doug Bell -- Senior Developer, Plain Black Corp.
[ http://plainblack.com ]
all that groks is

---------------------------------------------------------------------
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] How to define constant in apache configuration?

Posted by Eric Covener <co...@gmail.com>.
On Thu, Apr 23, 2009 at 4:43 AM, Alfonsas Stonis
<al...@gmail.com> wrote:
> SetEnv is supposed to work in this way, but it does not work. So, this
> is the envvars and ${enviroment_variable} seems to be the only one way
> to do it. I do not think there is any documentation of it.

"This module allows for control of the environment that will be
provided to CGI scripts and SSI pages"

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] How to define constant in apache configuration?

Posted by Alfonsas Stonis <al...@gmail.com>.
SetEnv is supposed to work in this way, but it does not work. So, this
is the envvars and ${enviroment_variable} seems to be the only one way
to do it. I do not think there is any documentation of it.

2009/4/23 Nick Kew <ni...@webthing.com>:
> On Wed, 22 Apr 2009 10:41:27 -0400
> "Mark H. Wood" <mw...@IUPUI.Edu> wrote:
>
>
>> Would you (or anyone) please point me to the relevant section of the
>> 2.2 documentation for the ${foo} method.  I've never seen this
>> mentioned. Clearly I'm not looking in the right place.  mod_macro
>> looks nice, but it's more than I need for simple manifest constants.
>
> They don't work generically.  Specific modules such as mod_rewrite,
> mod_filter, and mod_proxy_html support environment variables:
> see the docs for the modules in question.  If you want generic
> support, that's what mod_macro/mod_define are about.
>
> Trunk and 2.3.x versions also support them in evaluating expressions
> for <If "expr ..."> sections.
>
> --
> Nick Kew
>
> Application Development with Apache - the Apache Modules Book
> http://www.apachetutor.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
>
>

---------------------------------------------------------------------
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] How to define constant in apache configuration?

Posted by Nick Kew <ni...@webthing.com>.
On Wed, 22 Apr 2009 10:41:27 -0400
"Mark H. Wood" <mw...@IUPUI.Edu> wrote:


> Would you (or anyone) please point me to the relevant section of the
> 2.2 documentation for the ${foo} method.  I've never seen this
> mentioned. Clearly I'm not looking in the right place.  mod_macro
> looks nice, but it's more than I need for simple manifest constants.

They don't work generically.  Specific modules such as mod_rewrite,
mod_filter, and mod_proxy_html support environment variables:
see the docs for the modules in question.  If you want generic
support, that's what mod_macro/mod_define are about.

Trunk and 2.3.x versions also support them in evaluating expressions
for <If "expr ..."> sections.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.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] How to define constant in apache configuration?

Posted by "Mark H. Wood" <mw...@IUPUI.Edu>.
On Mon, Apr 20, 2009 at 10:17:50PM -0400, Eric Covener wrote:
> On Mon, Apr 20, 2009 at 9:23 PM, Alfonsas Stonis
> <al...@gmail.com> wrote:
> > I can not find now the definition, but there was some module for
> > apache 1.3 (maybe it was third party) that allowed to write define.
> > However, I found hard to believe that such basic thing would not be
> > supported in apache 2 configuration. There should be some easy way to
> > do this.
> 
> mod_macro, or set native environment variables (in bin/envvars
> provided by your apache pkg for example) and deref with ${foo}.

Would you (or anyone) please point me to the relevant section of the
2.2 documentation for the ${foo} method.  I've never seen this mentioned.
Clearly I'm not looking in the right place.  mod_macro looks nice, but
it's more than I need for simple manifest constants.

Thanks!

-- 
Mark H. Wood, Lead System Programmer   mwood@IUPUI.Edu
Friends don't let friends publish revisable-form documents.

Re: [users@httpd] How to define constant in apache configuration?

Posted by Alfonsas Stonis <al...@gmail.com>.
Setting environment variables in /etc/apache2/envvars and then using
it in config in ${} works! Thanks.

Example:

/etc/apache2/envvars
export LDAP_URL=ldap://localhost:7389/ou=vartotojai,o=mano?uid?

/etc/apache2/sites-enabled/httpd-ssl.conf
AuthLDAPURL ${LDAP_URL}

2009/4/22 inas inassen <me...@hotmail.com>:
> very nice, do you have any sample?
>
> Thanks.
>
>> Date: Tue, 21 Apr 2009 16:01:17 -0400
>> From: covener@gmail.com
>> To: users@httpd.apache.org
>> Subject: Re: [users@httpd] How to define constant in apache configuration?
>>
>> On Tue, Apr 21, 2009 at 3:59 PM, inas inassen <me...@hotmail.com>
>> wrote:
>> > Hi,
>> >
>> > I did some tests in the past using this way ${foo} by defining the
>> > variable
>> > foo in the bin/envvars file (like it works in Tomcat for example) but it
>> > fails for apache. So Eric, Please, can you provide us more detail if it
>> > worked for you?
>>
>> Works for me.
>>
>> --
>> Eric Covener
>> covener@gmail.com
>>
>> ---------------------------------------------------------------------
>> 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
>>
>
> ________________________________
> Téléchargez le nouveau Windows Live Messenger ! Téléchargez Messenger, c'est
> gratuit !

---------------------------------------------------------------------
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] How to define constant in apache configuration?

Posted by inas inassen <me...@hotmail.com>.
very nice, do you have any sample?

 

Thanks.
 
> Date: Tue, 21 Apr 2009 16:01:17 -0400
> From: covener@gmail.com
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] How to define constant in apache configuration?
> 
> On Tue, Apr 21, 2009 at 3:59 PM, inas inassen <me...@hotmail.com> wrote:
> > Hi,
> >
> > I did some tests in the past using this way ${foo} by defining the variable
> > foo in the bin/envvars file (like it works in Tomcat for example) but it
> > fails for apache. So Eric, Please, can you provide us more detail if it
> > worked for you?
> 
> Works for me.
> 
> -- 
> Eric Covener
> covener@gmail.com
> 
> ---------------------------------------------------------------------
> 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
> 

_________________________________________________________________
Sur Windows Live Ideas, découvrez en exclusivité de nouveaux services en ligne... si nouveaux qu'ils ne sont pas encore sortis officiellement sur le marché !
http://ideas.live.com

Re: [users@httpd] How to define constant in apache configuration?

Posted by Eric Covener <co...@gmail.com>.
On Tue, Apr 21, 2009 at 3:59 PM, inas inassen <me...@hotmail.com> wrote:
> Hi,
>
> I did some tests in the past using this way ${foo} by defining the variable
> foo in the bin/envvars file (like it works in Tomcat for example) but it
> fails for apache. So Eric, Please, can you provide us more detail if it
> worked for you?

Works for me.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] How to define constant in apache configuration?

Posted by inas inassen <me...@hotmail.com>.
Hi,

 

I did some tests in the past using this way ${foo} by defining the variable foo in the bin/envvars file (like it works in Tomcat for example) but it fails for apache. So Eric, Please, can you provide us more detail if it worked for you?

 

thanks,

 

Inas.

 


 
> Date: Mon, 20 Apr 2009 22:17:50 -0400
> From: covener@gmail.com
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] How to define constant in apache configuration?
> 
> On Mon, Apr 20, 2009 at 9:23 PM, Alfonsas Stonis
> <al...@gmail.com> wrote:
> > I can not find now the definition, but there was some module for
> > apache 1.3 (maybe it was third party) that allowed to write define.
> > However, I found hard to believe that such basic thing would not be
> > supported in apache 2 configuration. There should be some easy way to
> > do this.
> 
> mod_macro, or set native environment variables (in bin/envvars
> provided by your apache pkg for example) and deref with ${foo}.
> 
> -- 
> Eric Covener
> covener@gmail.com
> 
> ---------------------------------------------------------------------
> 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
> 

_________________________________________________________________
Découvrez toutes les possibilités de communication avec vos proches
http://www.microsoft.com/windows/windowslive/default.aspx

Re: [users@httpd] How to define constant in apache configuration?

Posted by Eric Covener <co...@gmail.com>.
On Mon, Apr 20, 2009 at 9:23 PM, Alfonsas Stonis
<al...@gmail.com> wrote:
> I can not find now the definition, but there was some module for
> apache 1.3 (maybe it was third party) that allowed to write define.
> However, I found hard to believe that such basic thing would not be
> supported in apache 2 configuration. There should be some easy way to
> do this.

mod_macro, or set native environment variables (in bin/envvars
provided by your apache pkg for example) and deref with ${foo}.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] How to define constant in apache configuration?

Posted by Alfonsas Stonis <al...@gmail.com>.
I can not find now the definition, but there was some module for
apache 1.3 (maybe it was third party) that allowed to write define.
However, I found hard to believe that such basic thing would not be
supported in apache 2 configuration. There should be some easy way to
do this.

2009/4/20 Krist van Besien <kr...@gmail.com>
>
> On Mon, Apr 20, 2009 at 7:37 AM, Alfonsas Stonis
> <al...@gmail.com> wrote:
> > Hi,
> >
> > I want to define constant that I will use latter in several places.
> > Old documentation says that there was Define statement (or similar)
> >
> > Define myUrl "ldap://localhost"
> > ...
> > AuthLDAPUrl $myUrl
>
> I don't think that there was ever, in any version of Apache, a way to
> do what you describe above.
>
> > However, there is nothing in current documentation (I was not able to
> > find the same or similar module).
> >
> > Can you tell me how to do it with apache2?
> >
> > I tried to search on web, but found only dozens of the same question
> > (no answers). I tried:
> >
> > SetEnv myUrl "ldap://localhost"
> > ...
> > AuthLDAPUrl $myUrl
> >
> > Did not worked too.
>
> You can't do this in Apache. You could try using mod_perl, which
> allows you to use perl statements in an apache config. But do you
> really want this amount of complexity?
>
> Krist
>
> --
> krist.vanbesien@gmail.com
> krist@vanbesien.org
> Bremgarten b. Bern, Switzerland
> --
> A: It reverses the normal flow of conversation.
> Q: What's wrong with top-posting?
> A: Top-posting.
> Q: What's the biggest scourge on plain text email discussions?
>
> ---------------------------------------------------------------------
> 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
>

---------------------------------------------------------------------
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] How to define constant in apache configuration?

Posted by Krist van Besien <kr...@gmail.com>.
On Mon, Apr 20, 2009 at 7:37 AM, Alfonsas Stonis
<al...@gmail.com> wrote:
> Hi,
>
> I want to define constant that I will use latter in several places.
> Old documentation says that there was Define statement (or similar)
>
> Define myUrl "ldap://localhost"
> ...
> AuthLDAPUrl $myUrl

I don't think that there was ever, in any version of Apache, a way to
do what you describe above.

> However, there is nothing in current documentation (I was not able to
> find the same or similar module).
>
> Can you tell me how to do it with apache2?
>
> I tried to search on web, but found only dozens of the same question
> (no answers). I tried:
>
> SetEnv myUrl "ldap://localhost"
> ...
> AuthLDAPUrl $myUrl
>
> Did not worked too.

You can't do this in Apache. You could try using mod_perl, which
allows you to use perl statements in an apache config. But do you
really want this amount of complexity?

Krist

-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
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