Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to include a windows enviroment variable in an httpd.conf?

Ideally I would like to set DocumentRoot to something like %PROGRAMDATA%\MyCompany\MyApp\htdocs.

Background: I'm trying to make a custom apache installer as part of a larger project. I could make installer write an absolute path into httpd.conf, but I'd prefer to keep the conf file portable if possible.

share|improve this question
up vote 3 down vote accepted

Based on this bug report it would appear that environment variable expansion in configuration files on Windows is a valid feature in Apache. Looks like you can use the same syntax as environment variable expansion that you would for Apache on a *nix OS-- ${variable_name}.

share|improve this answer
Excellent, thanks – Twelve47 Apr 14 '11 at 14:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.