upstream zone size

2017-11-28 Thread justink101
What is a reasonable value for upstream zone size? I'm just shooting in the dark with 64k right now. Running 64bit Linux. The official NGINX documentation does not elaborate on it, and I can't find anything useful on Google. upstream backends { zone example_zone 64k; keepalive 8l; ser

Re: RE: Track egress bandwidth for a server block

2017-11-13 Thread justink101
Thanks for linking, but nginx-module-vts seems over-kill and I'm concerned about performance. Essentially we are building a product that charges by egress bandwidth and looking for a way to track it at the NGINX level. I was digging a bit further and it seems like using https://www.nginx.com/blog/l

Track egress bandwidth for a server block

2017-11-13 Thread justink101
Is there a way to measure and store the amount of egress bandwidth in GB a given server{} block uses in a certain amount of days? Needs to be somewhat performant. Using NGINX Unit or Lua are both possible, just no idea how to implement it. Posted at Nginx Forum: https://forum.nginx.org/read.php?2

limit_conn with variables erroring with invalid number of connections

2017-04-23 Thread justink101
Here is the configuration: http { limit_conn_zone $binary_remote_addr zone=limitapinoauth:16m; limit_conn_zone $remote_user zone=limitapi:32m; map $remote_user $limit_zone { default limitapi; ''limitapinoauth; } map $remote_user $limit_number {

Re: Recusive includes

2015-09-18 Thread justink101
Arg, sorry for the typos. I really wish this forum allowed edits. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,261647,261648#msg-261648 ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx

Recusive includes

2015-09-18 Thread justink101
If I want to include all config files within a directly, and all child directories what is the syntax: If is still: include /etc/nginx/*.conf or is it: include /etc/nginx/**/*.conf Posted at Nginx Forum: http://forum.nginx.org/read.php?2,261647,261647#msg-261647 _

Multiple server blocks using spdy, reuseport, deferred

2015-09-18 Thread justink101
If we have multiple server blocks binding on https using SPDY, reuseport, and deferred nginx fails to start complaining about port already bound: server { listen 443 deferred ssl spdy reuseport; server_name app.foo.com; ... } server { listen 443 deferred ssl spdy reuseport; se

NginxPlus error: zero size buf in output

2015-09-08 Thread justink101
Hello, saw this logged in the error log in our NginxPlus (nginx/1.7.11 (nginx-plus-extras-r6-p1) load balancer. Any ideas? 2015/09/08 14:31:02 [alert] 2399#0: *452322 zero size buf in output t:0 r:0 f:1 - 02F51428 0-0 while sending request t

Using dynamic access_log, automatically create parent directory

2015-07-26 Thread justink101
We use a dynamic value for access logs: access_log /var/log/nginx/domains/$host/access.log main; However, if the $host directory does not exist in /var/log/nginx/domains nginx fails with an error creating the access log. Is there a way to have nginx create the $host directory automatically in

Storing $server_addr in a variable VS using it directly in location block

2015-07-14 Thread justink101
According to the documentation getting the value of $server_addr to set a response header makes a system call, and can impact performance negativelyset $ip $server_addr; server { location /health { add_header Backend $server_addr; return 200; } } Wo

How to "undo" a global server deny all in a location block

2015-03-09 Thread justink101
Is it possible to undo a server level deny all; inside a more specific location block? See the following: server { allow 1.2.3.4; allow 2.3.4.5; deny all; location / { location ~ ^/api/(?.*) { # bunch of directives } location = /actions/foo.

Re: Multiple proxy_pass destinations from a single location block

2015-02-05 Thread justink101
Thanks Igor. What if one of the servers listed in the upstream block should be over https and the other over http? How is this done using upstream proxies { server foo.mydomain.io; server bar.mydomain.com; } proxy_pass https://proxies/api/; Notice the proxy pass defines only a single sc

Multiple proxy_pass destinations from a single location block

2015-02-04 Thread justink101
Is it possible to specify multiple proxy_pass destinations from a single location block? Currently we have: location ~ ^/v1/?(?.+)? { resolver 208.67.222.222 208.67.220.220 valid=300s; resolver_timeout 10s; proxy_intercept_errors off; proxy_hide_header Vary; proxy_set_header Ho

Google QUIC support in nginx

2015-01-29 Thread justink101
Any plans to support Google QUIC[1] in nginx? [1] http://en.wikipedia.org/wiki/QUIC Posted at Nginx Forum: http://forum.nginx.org/read.php?2,256352,256352#msg-256352 ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/ngin

Re: Using proxy_ssl_verify getting error: upstream SSL certificate verify error: (20:unable to get local issuer certificate)

2014-08-16 Thread justink101
Setting: proxy_ssl_verify_depth 2; Fixed the issue. Can somebody explain why this is needed and why the default setting is 1? I am using a standard wildcard SSL certificate from GoDaddy. Thanks Posted at Nginx Forum: http://forum.nginx.org/read.php?2,252518,252620#msg-252620 _

Re: Using proxy_ssl_verify getting error: upstream SSL certificate verify error: (20:unable to get local issuer certificate)

2014-08-12 Thread justink101
Sorry, the proxy_ssl_ciphers directive got cut off, in full it is: proxy_ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"; Posted at

Using proxy_ssl_verify getting error: upstream SSL certificate verify error: (20:unable to get local issuer certificate)

2014-08-12 Thread justink101
I am trying to use proxy_ssl_verify on, but I am getting back 502 Bad Gateway. When I look at the logs I see: 2014/08/12 18:08:03 [error] 21007#0: *3 upstream SSL certificate verify error: (20:unable to get local issuer certificate) while SSL handshaking to upstream, client: XX.XXX.XXX.214, server

Re: Send 502 when all php-fpm workers are in use

2014-07-07 Thread justink101
Starting php-fpm: [07-Jul-2014 17:52:33] WARNING: [pool app-execute] listen.backlog(0) was too low for the ondemand process manager. I updated it for you to 128 Well that is unfortunate, not sure why using on-demand required a backlog of 128. Essentially this php-fpm pool runs jobs then the worker

Re: Send 502 when all php-fpm workers are in use

2014-07-06 Thread justink101
Maxim, If I set the php-fpm pool listen.backlog to 0, will this accomplish what I want. I.e. fill up workers, once all the workers are used, fail requests. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,251476,251488#msg-251488 ___ nginx mai

Send 502 when all php-fpm workers are in use

2014-07-05 Thread justink101
I have a php-fpm pool of workers which is 6. There are long running requests being sent, so I have the following fastcgi directives set: fastcgi_connect_timeout 15; fastcgi_send_timeout 1200; fastcgi_read_timeout 1200; However right now, if the php-fpm pool of workers is full, a request waits the

Parse JSON POST request into nginx variable

2014-06-14 Thread justink101
How can I read a POST request body which is JSON and get a property? I need to read a property and use it as a variable in proxy_pass. Pseudo code: $post_request_body = '{"account": "test.mydomain.com", "more-stuff": "here"}'; // I want to get $account = "test.mydomain.com"; proxy_pa

Redirect to custom landing pages based on http referer

2014-06-05 Thread justink101
Is it possible using nginx to essentially look at the http referer header, and if its set to a specific value, and the page is index.html or /, redirect to a custom landing page. For example: # Psuedo code if($page = "index.html" and $http_referer ~* (www\.)?amazon.com.*) { rewrite ^ "our-am

Re: Return JSON for 404 error instead of html

2014-05-14 Thread justink101
Noticed that the proxy request response headers are being thrown away in our 404 block. Note that the proxied request is returning 404. If I try and fetch a header that I know is being returned from the proxy it is undefined. location @four_o_four { internal; more_set_headers "X-Host: $sen

Re: Return JSON for 404 error instead of html

2014-05-14 Thread justink101
Thanks for the replies and sorry about the delay in responding. This is what we ended up using: error_page 404 = @four_o_four; location @four_o_four { internal; more_set_headers "X-Host: web4.ourdomain.com"; more_set_headers "Content-Type: application/json"; return 404 '{"stat

Return JSON for 404 error instead of html

2014-05-12 Thread justink101
How can I return a custom JSON body on 404, instead of the default html of: 404 Not Found 404 Not Found nginx Posted at Nginx Forum: http://forum.nginx.org/read.php?2,250033,250033#msg-250033 ___

Re: Requests being blocked client-side

2014-04-16 Thread justink101
Lee we switched to using memcached for sessions and this helped, but still seeing blocking, though less time. If we open two tabs, in the first page fire an ajax request that takes 20+ seconds to run, then in the second tab refresh, the page blocks loading in the second tab, but now instead of wai

Re: Requests being blocked client-side

2014-04-16 Thread justink101
Hi Lee. Yes using PHP. Could we simply just call session_write_close() immediately after we open and verify the session details? I'd like to avoid adding another piece of infrastructure (redis) on every web server. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,249233,249352#msg-249352

Re: Requests being blocked client-side

2014-04-16 Thread justink101
Maxim. Even after disabling SPDY and restarting nginx, still seeing the same behavior with requests blocking if another single request is outstanding in another tab. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,249233,249324#msg-249324 ___

Requests being blocked client-side

2014-04-11 Thread justink101
I am seeing super strange behavior and I am absolutely stumped. If I open up two tabs in Google Chrome (34), and in the first refresh our application (foo.ourapp.com), which makes an ajax requests (via jQuery) that takes 20 or so seconds to complete. Then in the other new tab hit refresh on (foo.ou

Cloak a hostname

2014-03-11 Thread justink101
Is it possible assuming I have a domain and uri: http://foo.bar/candy To have the browser location still show http://foo.bar/candy but actually fetch the content from: http://newdomain.com/candy I.E. simply replace the host. Assume I have: server { listen 443; server_name foo.b

Re: HttpLimitReqModule should return 429 not 503

2014-03-04 Thread justink101
Thanks, did not see this directive, exactly what is needed. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,248049,248065#msg-248065 ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx

HttpLimitReqModule should return 429 not 503

2014-03-03 Thread justink101
Can we get a flag in HttpLimitReqModule to return a http status code 429 Too Many Requests instead of 503 Service Temporarily Unavailable since this is a more accurate status code? I know that 429 is not officially defined, but it is a defacto-standard. Perhaps something like: limit_req_exce

Re: Setting a header inside an if block

2014-02-06 Thread justink101
Thanks that worked perfectly, though I must admit, a bit of a round-a-bout solution. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,247218,247263#msg-247263 ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/ngin

Re: Setting a header inside an if block

2014-02-05 Thread justink101
I don't have the auth_request module? All I need to do, is set the WWW-Authenticate header. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,247218,247227#msg-247227 ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listin

Setting a header inside an if block

2014-02-05 Thread justink101
I currently have: server{ ... if ($remote_user = "") { return 401; } ... } But what I really want is: server{ ... if ($remote_user = "") { add_header WWW-Authenticate 'Basic realm="mydomainhere.com"'; return 401; } ... } But nginx won't al

Re: Are headers set in the server block inherited to all location blocks

2014-02-05 Thread justink101
Gosh that is horrible that I have to copy and paste shared headers in the server block, to all location blocks. Is this a conscious decision? This makes maintainability very difficult as i have to do something like: [code] # shared_headers.conf add_header Alternate-Protocol 443:npn-spdy/3; add_he

Are headers set in the server block inherited to all location blocks

2014-02-04 Thread justink101
I am seeing strange behavior using includes. For example, if I request a javascript file (ending in .js) the headers set globally in the server block are not set. I was under the impression that if you set headers in the server block, ALL location blocks below inherit those headers. See the follow

proxy_pass check if 404, and return 404

2014-01-07 Thread justink101
I am using proxy_pass to a dynamic subdomain: proxy_pass https://$remote_user.mydomain.io Is it possible to have the proxy_pass check if the response of https://$remote_user.mydomain.io is 404, if so, simply do: return 404; I.E. don't proxy, immediately return. Posted at Nginx Forum:

Re: Very slow dns lookup using proxy_pass

2014-01-06 Thread justink101
Anybody have any further insight on this? Consistently slow DNS lookups from nginx, even though dig shows fast query times. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,246001,246070#msg-246070 ___ nginx mailing list nginx@nginx.org http://