You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by OwN-3m-All <ow...@gmail.com> on 2020/05/06 17:10:39 UTC

[users@httpd] mod_proxy_fcgi ProxyFCGISetEnvIf Directory Specific Override - How To?

Does anyone know if you can override a ProxyFCGISetEnvIf directive in a
directory section?  The documentation for mod_proxy_fcgi says it is valid
in a <Directory> section, but I'm not seeing the ProxyFCGISetEnvIf apply
when in the directory.

Here's an example:

<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>

When I'm in the "cooldir" directory, phpinfo() is showing the that the
open_basedir variable value did not change.  So, what's the hierarchy for
ProxyFCGISetEnvIf values in mod_proxy_fcgi?  I would imagine it should work
like nginx with specific directory declarations overriding the top level.
For example, in nginx, this works:

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;
    }
}

Any help is appreciated.

Re: [users@httpd] mod_proxy_fcgi ProxyFCGISetEnvIf Directory Specific Override - How To?

Posted by OwN-3m-All <ow...@gmail.com>.
> Use <Location> or <LocationMatch> to vary things based on the URL-path.

Thanks, that worked.  I was using the wrong directive.

Re: [users@httpd] mod_proxy_fcgi ProxyFCGISetEnvIf Directory Specific Override - How To?

Posted by Eric Covener <co...@gmail.com>.
On Wed, May 6, 2020 at 1:11 PM OwN-3m-All <ow...@gmail.com> wrote:
>
> Does anyone know if you can override a ProxyFCGISetEnvIf directive in a directory section?  The documentation for mod_proxy_fcgi says it is valid in a <Directory> section, but I'm not seeing the ProxyFCGISetEnvIf apply when in the directory.

"directory" context really means the handful of <Directory> like
containers (like Location, htaccess, etc)

For proxy related directives, <Directory> is usually never matched
because when a request is proxied (even to fastcgi) the request is
usually not mapped to anywhere on the Apache servers filesystem.

Use <Location> or <LocationMatch> to vary things based on the URL-path.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org