apache - Apache2 mod_proxy_fcgi ProxyFCGISetEnvIf 目录特定覆盖
问题描述
有谁知道您是否可以在目录部分覆盖 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>
推荐阅读
- ios - 从 firebase 检索用户信息
- javascript - 在反应本机应用程序中获取位置并调用状态更新功能
- amazon-web-services - 通过 RowVersion 更新记录,使用“SQL WHERE”过滤最大值
- sql - 如何在 postgreSQL 中执行深度优先搜索
- php - 如何防止 For Each 循环中的重复结果?
- html - 如何将 overflow-y 设置为 bootstrap-vue 表的单元格或行
- reactjs - NextJS + React Router - 部分 SSR 应用
- python - 如何在张量流中的某些函数中打印中间张量的值?
- python - 如何在 Google App Engine 上使用 Django 创建自定义 gunicorn 设置?
- python - h5py OSerror 由于文件关闭不当