![]() |
apache: Is apache config accepting shell env vars ?
Linux x86_64 GNU/Linux , Server version: Apache/2.2.8 (Linux/SUSE)
Is there a method to pass to apache config, shell env var in place of hardcoded value ? For examp I want apache reffer to config file defined by env var $PATH_TO_MY_LOCAL_CONFIG: ####################################################################### Code:
tnx. |
Apache has its own env. variables, but they cannot do what you want. Also you can use shell env. variables, but only for CGIs and SSIs
In your case, can use your env. variables in a script or CLI. For example (in bash): Code:
export PATH_TO_MY_LOCAL_CONFIG=/mydir/my_ver_0.1/httpd.conf.local |
Thanks for replay,
Finally thats worked .. (believe or not :o) ) Just share w/u my exp.. I did 2 thinks : ################################################## <CODE> 1. Added module that support envs: Should exists: /usr/lib64/apache2-prefork/mod_env.so vim /etc/sysconfig/apache2 APACHE_MODULES=".. .. .. env .. .." :wq vim /etc/apache2/sysconfig.d/loadmodule.conf LoadModule env_module /usr/lib64/apache2-prefork/mod_env.so :wq 2. Added directive and fixed syntax , env vars should be enclosed by curly brackets : vim /etc/apache2/httpd.conf PassEnv PATH_TO_MY_LOCAL_CONFIG <== (directive to provide env var) Include ${PATH_TO_MY_LOCAL_CONFIG} <== (should be in curly brackets) :wq </CODE> #################################################### Now after starting apache2ctl its loaded all setings that coming from file refered by $PATH_TO_MY_LOCAL_CONFIG Thats good feature, now I can conditionally define config by changing shell var without touching http.conf it self. Thanks. ~ |
| All times are GMT -5. The time now is 07:41 PM. |