Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

177
Views
Apache2 mod_proxy_fcgi ProxyFCGISetEnvIf Directory Specific Override

Does anyone know if you can override a ProxyFCGISetEnvIf directive in a directory section? The documentation for apache's mod_proxy_fcgi says it is valid in a 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.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You have to use a <Location> directive instead of a <Directory> directive according to a response I received on the apache users mailing list:

<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>
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!