Thank you. I am looking for an simpler ( direct ) approach. For now I have put a sed script in my bounce nginx which does that.by amodpandey - Nginx Mailing List - English
Let me put what I want to achieve. Before that I want to know what is this 'env' global directive for? I want to maintain a single set of configuration files for dev and prod. The machines would have environment variable set ENV=dev or ENV=prod. Based on the values of the ENV varibale I wanted to pick my upstream conf, either upstream_dev.conf or upstream_prod.conf through 'include upstream_by amodpandey - Nginx Mailing List - English
Hi, I have system where I have defined OS environment variable $ENV=prod or dev. I want to access this variable inside my nginx configuration. Please help. I have tried -g "env ENV" in command line. But how do I access it? $ENV does not work?by amodpandey - Nginx Mailing List - English
Thank you for your response. Versions nginx versions tried nginx/1.2.5 and nginx/1.3.9 LuaJIT 2.0.0 What I want achive? Set the value of $cookie_abc to "a"/"b" (some logic) if the cookie value is not coming in the request else use the value set. I am doing this in server level set $cookie_abc "$cookie_abc"; set $tmp_abc ""; set_by_lua $by amodpandey - Nginx Mailing List - English
It should not and it does not! If the client does not send a cookie with name "abc" or "def" I do not assume nginx to have any variable with that name. Am I missing anything?by amodpandey - Nginx Mailing List - English
The variable $cookie_abc will exist only if the client request cookie has "abc". In my case the first request won't have this cookie set and I am setting this value for some magic. Lua module is very this on this feature. If we do not have the variable defined you should set it before using. set $cookie_abc "$cookie_abc" If the above works as expected I am good.by amodpandey - Nginx Mailing List - English
Thank you. But this is not what I am looking for. The question is about defining $cookie_abc and default it to $cookie_abc itself (if the value exists). the map will give me the value in $abc which I am not looking for. BTW set $cookie_abc "$abc"; will still reset the value of $abc to defaultby amodpandey - Nginx Mailing List - English
I have some lua code where I play with the value of ngx.var.cookie_abc. The variable must exist if some assignment is done on it. To achieve this I did set $cookie_abc "$cookie_abc"; The above line clears the value of $cookie_abc, where in I assumed it to be defaulted if the value already exists. i.e. if request has cookie abc="test" set, the $cookie_abc will have vby amodpandey - Nginx Mailing List - English
I figured out a simple solution so thought to share it ( to get feedback or may be to help ). In an earlier discussion I got to know about map and why one should avoid to use if an try to use map. http { map $cookie_abt $abt { default "abt=a;Path=/"; ~.+$ ""; } server { listen 8081; location / { add_headerby amodpandey - Nginx Mailing List - English
One interesting observation I put this code location /test { proxy_pass http://a/; .... set $dont_cache 1; if ( $cookie_route ) { set $dont_cache 0; } proxy_cache_bypass $dont_cache; proxy_no_cache $dont_cache; } and it startby amodpandey - Nginx Mailing List - English
Thank you :) This one worked. I would like to take this opportunity to share the exact problem I had. I am using sticky module for some app version targetting. Plus I have enabled proxy cache. The sticky module works in a way that it first let the upstream handle the weights and according to which server catered the response it set cookie with server info hash. So the response that is cachedby amodpandey - Nginx Mailing List - English
I was trying this :) map $cookie_route $dont_cache { default 1; ~*+ 0; } Let me try your suggestion.by amodpandey - Nginx Mailing List - English
I did this ( my cookie name is cahe ) map $cookie_cache $dont_cache { 0 1; 1 0; } proxy_cache_bypass $dont_cache; proxy_no_cache $dont_cache; But the first request which does not have the cookie is getting cached.by amodpandey - Nginx Mailing List - English
I want to proxy_cache responses only with a specific cookie in request. I thought to use proxy_cache_bypass ! $cookie_cache; proxy_no_cache ! $cookie_cache; That ( ! ) does not work. One more question, why we need to have proxy_cache_bypass and proxy_no_cache else nginx: "proxy_no_cache" functionality has been changed in 0.8.46, now it should be used togetheby amodpandey - Nginx Mailing List - English
Please help me understand The below works location /stats/ { proxy_pass http://example.com; } or location /stats { proxy_pass http://example.com; } or location /stats { proxy_pass http://example.com/stats; } or location /stats { proxy_pass http://example.com/stats/; } or locatioby amodpandey - Nginx Mailing List - English
Hi , I have various upsteram configurations. I want to add or remove servers (scale up or down) from the upstream based on some parameters. Please provide your suggestions. One way that I think of is to update the upstream conf and perform a SIGHUP. Does not feel very good about it as I have to do it say 5 times a day and it the my main LB. Thanks Amodby amodpandey - Nginx Mailing List - English
Somewhere in the configuration there was proxy_buffering off :) I commented it and it started working.by amodpandey - Nginx Mailing List - English
http { proxy_cache_path /dev/shm/cache/nginx/ levels=1:2 keys_zone=cache:30m inactive=1d max_size=500M; proxy_temp_path /dev/shm/cache/nginx/tmp 1 2; proxy_cache_key "$scheme$request_method$request_uri"; server { .. location / { add_header X-Cache-Status $upstream_cache_status; proxy_pass $scheme://default; prby amodpandey - Nginx Mailing List - English
1. As I understand, we have to use HttpFastcgiModule for fastcgi call caching and HttpProxyModule for static files. Could someone please explain the reasons for why we have this distinction. In most of the cases I observed that there are similar directives only varying in the prefix, fastcgi_ vs proxy_. 2. I have a nginx server that has php-fpm. There I used the fastcgi_ cache and I could see tby amodpandey - Nginx Mailing List - English
Thank you agentzh. I is hitting memcache and I have rechecked it.by amodpandey - Nginx Mailing List - English
Thank you Agentzh. I did a test with a simple set up. Amazon large machine with nginx sering a file from disk and in another set-up serving teh same file from a local memcached. To my surprise I do not see any difference in the performance. They were equal. So given the complexity of memcache in between I see not having memcache is better. How could be this possible? I did test to 100, 300 aby amodpandey - Nginx Mailing List - English
Thank you Agentzh. I will look into that. I have an associated question. I have a memcache cluster (multiple nodes). So I defined an upstream memcached_pass_stream { server node1:11211; server node2:11211; server node3:11211; server node4:11211; } And I pass it memcached_pass $scheme://memcached_pass_stream/; I am using memcached cluster (AWS ElastiCache) Q1 I hopby amodpandey - Nginx Mailing List - English
Using HttpMemcachedModule I could easily integrate memcache with nginx. I wanted to know how do I set the missing htmls into memcache. Like this If $uri in memchache serve from memcache else set into memcache server from proxy Please suggestby amodpandey - Nginx Mailing List - English
This works location ~*\.php$ { root /home/ec2-user/www/api; include /home/ec2-user/conf/proxy.conf; include /home/ec2-user/conf/fastcgi.conf; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #if (-f $request_filename) { fastcgi_pass api.example.com:9000; #} } } So root is only required for fastcgi_param script filby amodpandey - How to...
Hello, With the current configuration we have php-fpm running on the same machine as nginx. We want to move php-fpm to run on separate machines for scaling purpose. location ~*\.php { root /home/ec2-user/www/api/; include /home/ec2-user/conf/proxy.conf; include /home/ec2-user/conf/fastcgi.conf; if (-f $request_filename) { fastcgi_pass 127.0.0.1:9000;by amodpandey - How to...
I have printed some log messages in my php. I have not configured my log4j to print to a log file so it should go to the stdout/stderr. I am not able to find a file where I can see these log messages. If I run my php using cli I can see the log messages. There is /var/php5-fpm.log but this contains only php5-fpm related logs.by amodpandey - Php-fpm Mailing List - English
Did you find it? Which OS?by amodpandey - Php-fpm Mailing List - English
![]() |
![]() |
![]() |
![]() |
![]() |