是否有选项将DocumentRoot赋值引用为之后的虚拟主机声明中的变量?
例如:
<VirtualHost 127.0.0.1:80>
DocumentRoot /var/www/html/some/folder
ModPagespeedLoadFromFileMatch "^http://([a-zA-Z0-9-.]+)/(.+)$" "%{DOCUMENT_ROOT}/\\2"
</VirtualHost>发布于 2012-11-19 10:32:36
例如,您可以在apache2配置中替换环境变量。
root@nada:/etc/apache2/sites-enabled# grep DOCROOT 000-default
DocumentRoot ${DOCROOT}
root@nada:/etc/apache2/sites-enabled# export DOCROOT="test"
root@nada:/etc/apache2/sites-enabled# apachectl configtest
Warning: DocumentRoot [/etc/apache2/test] does not exist
Syntax OK
root@nada:/etc/apache2/sites-enabled# 在Debian上,您有特殊的文件/etc/apache2/envvars,您可以在其中放置这些环境变量。在其他发行版上,这可能是以不同的方式完成的。
当然,您可以简单地编辑apache2 init.d脚本来加载一些环境变量:-)
https://serverfault.com/questions/450021
复制相似问题