有人知道您是否可以在目录部分中重写ProxyFCGISetEnvIf指令吗? apache的mod_proxy_fcgi的文档说它在某节中是有效的,但是在目录中时我看不到ProxyFCGISetEnvIf适用。
这里是一个例子:
<VirtualHost *:443>
ServerName test7.com
ServerAlias
DocumentRoot /var/www/test
ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9001/var/www/test/$1
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir=/var/www/test:/usr/share/php:/usr/share/pear \n upload_tmp_dir=/tmp; \n session.save_path=/var/www/php_sessions;"
<Directory "/var/www/test/cooldir">
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir=/var/www/test:/var/www:/usr/share/php:/usr/share/pear \n upload_tmp_dir=/tmp; \n session.save_path=/var/www/php_sessions;"
</Directory>
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/test7.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/test7.com/privkey.pem
</VirtualHost>
当我在“ cooldir”目录中时,phpinfo()显示的是open_basedir变量值未更改。那么,mod_proxy_fcgi中ProxyFCGISetEnvIf值的层次结构是什么?我想它应该像nginx一样工作,具有覆盖顶层的特定目录声明。例如,在nginx中,此方法有效:
location /cooldir {
root /var/www/test/;
index index.php index.html index.htm;
location ~ ^/cooldir/(.+\.php)$ {
try_files $uri =404;
root /var/www/test/;
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param PHP_ADMIN_VALUE "open_basedir=/var/www:/tmp:/usr/share:/var/www/php_sessions \n upload_tmp_dir=/tmp \n session.save_path=/var/www/php_sessions";
include /etc/nginx/fastcgi_params;
limit_req zone=one burst=5;
}
}
感谢您的任何帮助。
根据我在apache用户邮件列表上收到的响应,您必须使用<Location>
指令而不是<Directory>
指令:
<Location "/webmail">
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir=/var/lib/roundcube:/etc/roundcube:/usr/share:/tmp:/var/www/php_sessions:/var/log/roundcube; \n upload_tmp_dir=/tmp; \n session.save_path=/var/www/php_sessions;"
</Location>