Apache: open_basedir with variable
I now hav开发者_如何学Pythone this:
<Directory ~ "^/home/.*">
php_flag open_basedir "/home/$1"
</Directory>
But that doesn't work. How can I refer to that .*
?
Not possible. Apache does not interpret any variable settings in directives. You can use %1
style RewriteCond backreferences in some, or %{DOCUMENT_ROOT}
even. But most directives use static values.
Specifically PHPs Apache SAPI does not attempt to interpret any %
or $
sequences.
There are a few workarounds listed on Serverfault: Using variables in Apache config files to reduce duplication?. But neither mod_macro
or mod_define
will accomplish what you want. You will have to define it for each home directory separately. (That is also what Plesk and Confixx do for multiple accounts.)
精彩评论