How to use environment variables in apache vhost

Viewed 3519

I have a environment variable called DISTANT_APP_ADDR:

$ echo $DISTANT_APP_ADDR
$ 172.17.0.102

I want to use this variable in my vhost, so I've added in the /etc/apache2/envvars file :

export DISTANT_APP_ADDR=${DISTANT_APP_ADDR}

In my vhost :

FastCgiExternalServer /var/www/cgi-bin/php5.external -host ${DISTANT_APP_ADDR}:9000

But when I restart apache, I've the error :

$ service apache2 restart
$ FastCgiExternalServer /var/www/cgi-bin/php5.external: failed to resolve "" to exactly one IP address

By replacing ${DISTANT_APP_ADDR} in the envvars file with the real value it's working.

I've also to to put a PassEnv DISTANT_APP_ADDR in my vhost file, but the result is the same.

How can I pass my env vars to my vhost file ?

1 Answers
Related