RE: [users@httpd] Enviroment variables in .conf?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: news [mailto:news@xxxxxxxxxxxxx] On Behalf Of Yusuf
> Sent: Tuesday, October 10, 2006 7:29 PM
> To: users@xxxxxxxxxxxxxxxx
> Subject: [users@httpd] Enviroment variables in .conf?
> 
> Hi,
> 
> is there any method/module that will allow me to use enviroment 
> variables in httpd.conf?

Not that I know of - basically, the config file is just a flat text file
that apache reads at runtime and loads a structure with key-value pairs.
There is no mechanism for variable substitution.

An alternative that's widely used is to write a perl-script that
generates the config and to run this script immediately before starting
apache (eg, hack "apachectl" and execute the script right at the top).

You can then get the script to read any variable you like and interpose
it in the config.

Rgds,
Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored. 

> 
> Specifically, I want Apache to run straight from a cd in Ms. Windows, 
> and I require a temporal directory and other settings currently hard 
> coded, like this:
> 
> Listen localhost:8080
> PidFile c:/temp/apache/apache_httpd.pid
> ErrorLog c:/temp/apache/apache_error.log
> CustomLog c:/temp/apache/apache_access.log common
> Alias /cgi_tmp/ c:/temp/apache/cgi_tmp/
> 
> but not everyone has the needed write permission or, alas, even a C: 
> drive, so I would hope something like this is possible:
> 
> autorun.bat:
> set APACHE_PORT=8080
> 
> if not exist %TEMP%\apache md %TEMP%\apache > NUL
> if not exist %TEMP%\apache\cgi_tmp md %TEMP%\apache\cgi_tmp > NUL
> 
> start /min \Apache\bin\Apache.exe
> sleep 5
> 
> start http://localhost:%APACHE_PORT%/
> 
> 
> httpd.conf:
> Listen localhost:%{ENV:APACHE_PORT}
> PidFile %{ENV:TEMP}/apache/apache_httpd.pid
> ErrorLog %{ENV:TEMP}/apache/apache_error.log
> CustomLog %{ENV:TEMP}/apache/apache_access.log common
> Alias /cgi_tmp/ %{ENV:TEMP}/apache/cgi_tmp/
> PassEnv TEMP
> 
> I know I could copy the conf files to the hard drive and replace the 
> paths there but I'd prefer a cleaner solution.
> 
> Also, for an extra point, I would like suggestions on how to 
> check if a 
> port is available for Apache prior to running it, from a .bat file.
> 
> Thanks in advance.
> 
> 
> ---------------------------------------------------------------------
> 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@xxxxxxxxxxxxxxxx
>    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>
 
 
This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please notify the sender urgently and then immediately delete the message and any copies of it from your system. Please also immediately destroy any hardcopies of the message. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. The sender's company reserves the right to monitor all e-mail communications through their networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of the sender's company.

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux