httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yusuf <yusu...@gmail.com>
Subject [users@httpd] Enviroment variables in .conf?
Date Tue, 10 Oct 2006 17:29:27 GMT
Hi,

is there any method/module that will allow me to use enviroment 
variables in httpd.conf?

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


Mime
View raw message