我开始在/ etc / apache2 / envvars中创build新variables来问这个问题? 。 我试图通过在/etc/apache2/envvars声明几个特定于服务器的variables来干掉我的Apacheconfiguration,然后在我的httpd.conf使用它们,但是我无法使apache识别新的variables。
正如@ouranos发现的,我可以使用PassEnv来声明新的variables..但只有一个新的variables: RAILS_ENV 。 看这个:
/ etc / apache2 / envvars :
export RAILS_ENV=production export OUR_HOST_NAME='web.production.example.com'
/ etc / apache2 / sites-enabled / example :
PassEnv OUR_HOST_NAME RAILS_ENV ErrorLog ${APACHE_LOG_DIR}/${OUR_HOST_NAME}-error.log CustomLog ${APACHE_LOG_DIR}/${RAILS_ENV}-access.log combined
ls -1 / var / log / apache2 * – *:
${OUR_HOST_NAME}-error.log production-access.log
什么? 在PassEnv切换两个variables的PassEnv也不起作用。
正如在另一个问题上说,你可能必须做apache2ctl stop && apache2ctl start作为apache2ctl restart似乎并没有读取envvars文件的变化。