Re: Insert Variable Values when loading a Cloud Config?

2016-07-11 Thread leeand00
This is just a guess, but probably a hashap...or maybe a DNS server that
assigns them statically.  But I suppose CoreOS has to request it from nginx,
so it could probably even just pull it out of the request.

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?2,268241,268250#msg-268250

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


Re: forced 404 without a location display ?

2016-07-11 Thread Maxim Dounin
Hello!

On Mon, Jul 11, 2016 at 03:26:30PM -0400, Jonathan Vanasco wrote:

> I have some servers where I use an old method of gating a path 
> by using a file check.
> 
> this allows staff to turn off certain locations during 
> migrations/updates without having root privileges (needed to 
> restart nginx)
> 
> an issue I noticed– this method now (perhaps always) shows the 
> name of the location on the default 404 template [the response 
> that nginx generates via code, not a template on the fs]
> 
> Does anyone know how to disable showing the location without 
> defining a custom template on the filesystem?  or perhaps 
> someone can think of a better way to accomplish my goals?
> 
> 
> 
> location /paths/to/ {
> if (!-f /etc/nginx/_flags/is_running) {
> rewrite ^.*$ @is_running break;
> }
> }
> location = @is_running {
> return 404;
> }
> 
> ===
> that generates this
> 
> 
>   
>
> 404 Not Found
>
>
> 404 Not Found
> The resource could not be found.
>   /@is_running
> 
> 
>
>   

This is not something nginx generates.
An nginx-generated error will look like:


404 Not Found

404 Not Found
nginx/1.11.3



No location information is added by nginx to error pages, and 
never was.  You are probably using something with 3rd party 
patches.  An obvious fix is to switch to using vanilla nginx 
instead, it can be downloaded here:

http://nginx.org/en/download.html

-- 
Maxim Dounin
http://nginx.org/

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Re: forced 404 without a location display ?

2016-07-11 Thread Oleg A. Mamontov
On Mon, Jul 11, 2016 at 03:26:30PM -0400, Jonathan Vanasco wrote:
> I have some servers where I use an old method of gating a path by using a 
> file check.
> 
> this allows staff to turn off certain locations during migrations/updates 
> without having root privileges (needed to restart nginx)
> 
> an issue I noticed– this method now (perhaps always) shows the name of the 
> location on the default 404 template [the response that nginx generates via 
> code, not a template on the fs]
> 
> Does anyone know how to disable showing the location without defining a 
> custom template on the filesystem?  or perhaps someone can think of a better 
> way to accomplish my goals?
> 
> 
> 
> location /paths/to/ {
> if (!-f /etc/nginx/_flags/is_running) {
> rewrite ^.*$ @is_running break;
> }
> }
> location = @is_running {
> return 404;
> }
> 
> ===
> that generates this
> 
> 
>   
>
> 404 Not Found
>
>
> 404 Not Found
> The resource could not be found.
>   /@is_running
> 
> 
>
>   

=
location /paths/to/ {
if ( !-f /etc/nginx/_flags/is_running ) {
rewrite ^ /is_running last;
}
}
location = /is_running {
internal;
return 404 'nothing\n';
}
=

Does it work for you?

-- 
Cheers,
Oleg A. Mamontov

mailto: o...@mamontov.net

skype:  lonerr11
cell:   +7 (903) 798-1352

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

forced 404 without a location display ?

2016-07-11 Thread Jonathan Vanasco
I have some servers where I use an old method of gating a path by using a file 
check.

this allows staff to turn off certain locations during migrations/updates 
without having root privileges (needed to restart nginx)

an issue I noticed– this method now (perhaps always) shows the name of the 
location on the default 404 template [the response that nginx generates via 
code, not a template on the fs]

Does anyone know how to disable showing the location without defining a custom 
template on the filesystem?  or perhaps someone can think of a better way to 
accomplish my goals?



location /paths/to/ {
if (!-f /etc/nginx/_flags/is_running) {
rewrite ^.*$ @is_running break;
}
}
location = @is_running {
return 404;
}

===
that generates this



 
  404 Not Found
 
 
  404 Not Found
  The resource could not be found.
/@is_running


 

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


Re: Insert Variable Values when loading a Cloud Config?

2016-07-11 Thread Francis Daly
On Mon, Jul 11, 2016 at 09:40:45AM -0400, leeand00 wrote:

Hi there,

> The question involves trying to have nginx fill in the variables for the
> $private_ipv4 and $public_ipv4 when a config is loaded up.  Does this
> require that I use php-fpm to somehow recognize the machine sending the
> request, and then fill in the variables when the cloud-config is requested?

I think that the nginx side of the question is:

A file exists on the filesystem. A request is made for the matching
url. Can nginx return the file contents, making some textual substitutions
in the file contents?

If that is the question, then the answers probably involves: does nginx
know what the desired substitutions are? (As in, where do the suitable
values for $private_ipv4 and $public_ipv4 come from?)

If nginx can know, then probably the sub_filter module
(http://nginx.org/r/sub_filter) can help.

You made need to check that you can include a literal $ in the string
to replace, but that should be a straightforward enough test after you
know that nginx can know what the replacement strings are.

If sub_filter is not suitable, then you could use any other active content
system (such as php-fpm) to do the work. The details will matter.

Good luck with it,

f
-- 
Francis Dalyfran...@daoine.org

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


One goal. 2 settings. Which one would you recommend?

2016-07-11 Thread matt_l
Hi

I am debating what is a better setting between the 2 settings below. 

Setting#1 and Setting#2 attempt to do the same task (flow control by
controlling the IP sources). 

Setting#1 uses one machine and Setting#2 uses 2 machines in a cascading
manner.

Thank you for your help

1. Setting #1 1 machine with N CPU
===

[...]

upstream dynamic {
least_conn;
server XXX.XXX.XXX.XXX:9990;
[…]
keepalive 5;
}

upstream locallayer {
server 127.0.0.1:7999;
keepalive 200;
}

limit_conn_zone $binary_remote_addr zone=peripconn:100m;
limit_req_zone $binary_remote_addr zone=peripreq:1000m rate=3r/s;

server {
listen 7999;
server_name local.com;
proxy_intercept_errors on;
location / {
limit_conn peripconn 160;
limit_req zone=peripreq burst=100 nodelay;
limit_conn_status 503;
limit_req_status 503;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_connect_timeout 10ms;
proxy_send_timeout 10ms;
proxy_read_timeout 60ms;
proxy_pass http://dynamic;
}
error_page 302 400 403 404 408 500 502 503 504 = /empty;
location /empty {
return 204;
}
}

server {
listen 8002;
proxy_intercept_errors on;

location / {
limit_conn peripex 5;
limit_conn_status 503;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://locallayer;
}
error_page 302 400 403 404 408 500 502 503 504 = /empty;
location /empty {
return 204;
}
}

[...]

2. Setting #2 2 machines each N/2 CPU
==

- Machine #1:

[...]

upstream machine2 {
least_conn;
server ip/of/machine2:7999;
keepalive 200;
}

server {
listen 8002;
proxy_intercept_errors on;

location / {
limit_conn peripex 5;
limit_conn_status 503;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://machine2;
}
error_page 302 400 403 404 408 500 502 503 504 = /empty;
location /empty {
return 204;
}
}

[...]

- Machine #2:

[...]

upstream dynamic {
least_conn;
server XXX.XXX.XXX.XXX:9990;
[…]
keepalive 5;
}

limit_conn_zone $binary_remote_addr zone=peripconn:100m;
limit_req_zone $binary_remote_addr zone=peripreq:1000m rate=3r/s;

server {
listen 7999;
server_name local.com;
proxy_intercept_errors on;
location / {
limit_conn peripconn 160;
limit_req zone=peripreq burst=100 nodelay;
limit_conn_status 503;
limit_req_status 503;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_connect_timeout 10ms;
proxy_send_timeout 10ms;
proxy_read_timeout 60ms;
proxy_pass http://dynamic;
}
error_page 302 400 403 404 408 500 502 503 504 = /empty;
location /empty {
return 204;
}
}
[...]

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?2,268243,268243#msg-268243

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Insert Variable Values when loading a Cloud Config?

2016-07-11 Thread leeand00
I asked a question on another site
(http://stackoverflow.com/questions/37032806/does-bare-metal-coreos-etcd2-support-the-templating-feature-of-coreos-cloudinit)
about loading a cloud config from nginx onto a bare-metal core-os machine. 


The question involves trying to have nginx fill in the variables for the
$private_ipv4 and $public_ipv4 when a config is loaded up.  Does this
require that I use php-fpm to somehow recognize the machine sending the
request, and then fill in the variables when the cloud-config is requested?

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?2,268241,268241#msg-268241

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


Re: AW: Issue with HTTP/2 and async file upload from Safari on iOS

2016-07-11 Thread ZaneCEO
@itpp2012 : building from source is a no-go for me due to future upgrade
concerns

@Lukas : will follow your suggestion and try the ngingx-provided bins,
thanks!

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?2,267385,268236#msg-268236

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx