【问题标题】:Apache: open_basedir with variableApache:带变量的 open_basedir
【发布时间】:2011-08-06 22:29:30
【问题描述】:

我现在有了这个:

<Directory ~ "^/home/.*">
php_flag open_basedir "/home/$1"
</Directory>

但这不起作用。我怎么能引用那个.*

【问题讨论】:

    标签: php apache apache2 directory open-basedir


    【解决方案1】:

    不可能。 Apache 不解释指令中的任何变量设置。您可以在某些情况下使用%1 样式的 RewriteCond 反向引用,甚至可以使用%{DOCUMENT_ROOT}。但大多数指令使用静态值。

    特别是 PHP Apache SAPI 不会尝试解释任何 %$ 序列。

    Serverfault: Using variables in Apache config files to reduce duplication? 上列出了一些解决方法。但是mod_macromod_define 都不会完成你想要的。您必须分别为每个主目录定义它。 (这也是 Plesk 和 Confixx 为多个帐户所做的事情。)

    【讨论】:

    • Thnx,我们会那样做的:)。
    猜你喜欢
    • 2013-03-25
    • 1970-01-01
    • 1970-01-01
    • 2011-06-02
    • 1970-01-01
    • 2012-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多