How to define a variable in apache's httpd.conf file?

Viewed 103470

I want to define a variable in Apache server's httpd.conf configuration file.

Ex: variable static_path = C:\codebase\snp_static

and I want to use this variable (static_path) in httpd.conf where ever required.

Please tell me how can define a variable in httpd.conf file ?

5 Answers

Late to the question but recently had this issue and fixed it like so:

DEFINE path "C:\path/to the/directory"

Then later use like so:

DocumentRoot ${path} <Directory ${path}>

Note: In the path use \ after the drive letter

If your apache project is not taking system's environmental variables which we added to bashrc, We can directly EXPORT variables to /etc/apache2/envvars file

example: export ADMIN='Bibin'

Related