Quantcast
Channel: Nginx Forum
Viewing all 53287 articles
Browse latest View live

Re: Routing based on ALPN

$
0
0
Wiktor,

On Wed, Mar 07, 2018 at 12:38:51PM +0100, Wiktor Kwapisiewicz via nginx wrote:
> > below is the initial version of patch that creates the
> > "$ssl_preread_alpn_protocols" variable; the content is a comma-separated
> > list of protocols, sent by client in ALPN extension, if present.
> >
> > Any feedback is appretiated.
> >
>
> I have just tested this patch and can confirm it's working perfectly fine.

We have committed the patch.

http://hg.nginx.org/nginx/rev/79eb4f7b6725

Thanks for cooperation.

--
Roman Arutyunyan
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Upstream requests via proxies

$
0
0
Hello everyone,

I ran into a corner case with a project I'm fiddling with which requires
making upstream requests via IP restricted 3rd party proxies (no auth).
Would this, or anything similar even be possible?
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

One upstream connection blocks another upstream connection

$
0
0
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

One upstream connection blocks another upstream connection

$
0
0
Hi,



I’m investing a problem where I get delays in requests that is proxied to
an upstream service.

By looking at the debug log it seems that one request is blocking the
worker so it can’t complete another requests.



If you look at the log below request *352 is handled by worker 18728. This
worker then starts to process request *360 but for reason it is blocked at
13:53:53 until 13:54:03. How can that happen ?



The upstream service for request *360 doesn’t send any data in the time
interval 13:53:53-15:54:03.

But the upstream service for request *352 responses nearly immediately.

(I have examined the communication between nginx and the upstream in
wireshark)



Another observation, in the time interval 13:53:53-15:54:03 the worker
process seems to be in state D (uninterruptible sleep)



So my question is: What can block worker 18728 so it doesn’t complete
request *352



OS: Redhat 7.4

Nginx: 1.12.2



Hopefully I have provided enough details.



Thanks in advance

Lars









---------------- nginx debug error log
---------------------------------------------------------------------



2018/03/09 13:53:40 [debug] 18726#0: *249 input buf #95517

2018/03/09 13:53:32 [debug] 18728#0: *189 pipe temp offset: 588029952

2018/03/09 13:53:40 [debug] 18726#0: *249 input buf #95518

2018/03/09 13:53:32 [debug] 18728#0: *189 readv: eof:0, avail:1

2018/03/09 13:53:40 [debug] 18726#0: *249 pipe offset: 368738304

2018/03/09 13:53:32 [debug] 18728#0: *189 readv: 2, last:4096

2018/03/09 13:53:40 [debug] 18726#0: *249 pipe buf ls:1 0000556CF522BAF0,
pos 0000556CF522BAF0, size: 4096

2018/03/09 13:53:40 [debug] 18726#0: *249 pipe buf ls:1 0000556CF5233250,
pos 0000556CF5233250, size: 4096

2018/03/09 13:53:32 [debug] 18728#0: *189 pipe recv chain: 8192

2018/03/09 13:53:40 [debug] 18726#0: *249 pipe buf ls:1 0000556CF522EB20,
pos 0000556CF522EB20, size: 4096

2018/03/09 13:53:32 [debug] 18728#0: *189 input buf #144060

2018/03/09 13:53:40 [debug] 18726#0: *249 size: 8192

2018/03/09 13:53:32 [debug] 18728#0: *189 input buf #144061

2018/03/09 13:53:40 [debug] 18726#0: *249 writev: 22, 8192, 368738304

2018/03/09 13:53:32 [debug] 18728#0: *189 pipe offset: 588029952

2018/03/09 13:53:32 [debug] 18728#0: *189 pipe buf ls:1 0000556CF5220480,
pos 0000556CF5220480, size: 4096

2018/03/09 13:53:32 [debug] 18728#0: *189 pipe buf ls:1 0000556CF5233250,
pos 0000556CF5233250, size: 4096

2018/03/09 13:53:40 [debug] 18726#0: *249 pipe temp offset: 368746496

2018/03/09 13:53:32 [debug] 18728#0: *189 pipe buf ls:1 0000556CF522CAF0,
pos 0000556CF522CAF0, size: 4096

2018/03/09 13:53:53 [debug] 18729#0: *352 writev: 418 of 418

2018/03/09 13:53:40 [debug] 18726#0: *249 readv: eof:0, avail:1

2018/03/09 13:53:32 [debug] 18728#0: *189 size: 8192

2018/03/09 13:53:53 [debug] 18729#0: *352 chain writer out: 0000000000000000

2018/03/09 13:53:40 [debug] 18726#0: *249 readv: 2, last:4096

2018/03/09 13:53:53 [debug] 18729#0: *352 event timer del: 14: 1520603638051

2018/03/09 13:53:32 [debug] 18728#0: *189 writev: 18, 8192, 588029952

2018/03/09 13:53:53 [debug] 18729#0: *352 event timer add: 14:
86400000:1520690033051



----------- lines removed ------------------------------------------



2018/03/09 13:53:53 [debug] 18729#0: *360 pipe buf in s:1 t:1 f:0
0000556CF5232240, pos 0000556CF5232240, size: 4096 file: 0, size: 0

2018/03/09 13:53:53 [debug] 18729#0: *360 pipe buf free s:0 t:1 f:0
0000556CF5236280, pos 0000556CF5236280, size: 75 file: 0, size: 0

2018/03/09 13:53:53 [debug] 18729#0: *360 pipe length: -1

2018/03/09 13:53:53 [debug] 18729#0: *360 event timer: 18, old:
1520690033267, new: 1520690033348

2018/03/09 13:53:53 [debug] 18729#0: *360 event timer add: 16:
86400000:1520690033348

2018/03/09 13:53:53 [debug] 18729#0: *360 http upstream request:
"/download_stream/http://127.0.0.1:46766/5ad8c4fe-c9a5-4d3e-ad57-18ad8

18bc29f.pcap?"

2018/03/09 13:53:53 [debug] 18729#0: *360 http upstream dummy handler

2018/03/09 13:54:03 [debug] 18729#0: *360 http upstream request:
"/download_stream/http://127.0.0.1:46766/5ad8c4fe-c9a5-4d3e-ad57-18ad8

18bc29f.pcap?"

2018/03/09 13:54:03 [debug] 18729#0: *360 http upstream process upstream

2018/03/09 13:54:03 [debug] 18729#0: *360 pipe read upstream: 1

2018/03/09 13:54:03 [debug] 18729#0: *360 readv: eof:1, avail:1



----------- lines removed ------------------------------------------



2018/03/09 13:54:03 [debug] 18729#0: *360 SSL_write: -1

2018/03/09 13:54:03 [debug] 18729#0: *360 SSL_get_error: 3

2018/03/09 13:54:03 [debug] 18729#0: *360 http write filter 0000556CF5235600

2018/03/09 13:54:03 [debug] 18729#0: *360 http copy filter: -2
"/download_stream/http://127.0.0.1:46766/5ad8c4fe-c9a5-4d3e-ad57-18ad818

bc29f.pcap?"

2018/03/09 13:54:03 [debug] 18729#0: *360 http writer output filter: -2,
"/download_stream/http://127.0.0.1:46766/5ad8c4fe-c9a5-4d3e-ad

57-18ad818bc29f.pcap?"

2018/03/09 13:54:03 [debug] 18729#0: *360 event timer: 16, old:
1520690043209, new: 1520690043209

2018/03/09 13:54:03 [debug] 18729#0: *352 http upstream request:
"/1/search/74dc9b3c-dd89-11e6-9b3b-0894ef39879c/99fbbec6-a6f5-4f42-82f

6-5cc2f9651f45?"

2018/03/09 13:54:03 [debug] 18729#0: *352 http upstream process header

2018/03/09 13:54:03 [debug] 18729#0: *352 malloc: 0000556CF524C2D0:4096

2018/03/09 13:54:03 [debug] 18729#0: *352 recv: eof:1, avail:1

2018/03/09 13:54:03 [debug] 18729#0: *352 recv: fd:14 278 of 4096

2018/03/09 13:54:03 [debug] 18729#0: *352 http proxy status 200 "200 OK"

2018/03/09 13:54:03 [debug] 18729#0: *352 http proxy header: "Syncuuid:
5304cf38-1cd8-11e6-bddc-0894ef1af70f"

2018/03/09 13:54:03 [debug] 18729#0: *352 http proxy header:
"Content-Length: 78"

2018/03/09 13:54:03 [debug] 18729#0: *352 http proxy header: "Syncmagic: 3"

2018/03/09 13:54:03 [debug] 18729#0: *352 http proxy header: "Content-Type:
application/json"

2018/03/09 13:54:03 [debug] 18729#0: *352 http proxy header: "Server:
Pandion/7.3.3-3933"

2018/03/09 13:54:03 [debug] 18729#0: *352 http proxy header:
"Transfer-Encoding: chunked"

2018/03/09 13:54:03 [debug] 18729#0: *352 http proxy header done

2018/03/09 13:54:03 [debug] 18729#0: *352 HTTP/1.1 200 OK

Date: Fri, 09 Mar 2018 13:54:03 GMT

Content-Type: application/json
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Re: 1.13.9 compile errors

$
0
0
Maxim Dounin Wrote:
-------------------------------------------------------
>
> The following patch should fix this, please test if it works for
> you:
>
> # HG changeset patch
> # User Maxim Dounin <mdounin@mdounin.ru>
> # Date 1520919437 -10800
> # Tue Mar 13 08:37:17 2018 +0300
> # Node ID 649427794a74c74eca80c942477d893678fb6036
> # Parent 0b1eb40de6da32196b21d1ed086f7030c10b40d2
> Configure: fixed static compilation with OpenSSL 1.1.1-pre2.
>
> OpenSSL now uses pthread_atfork(), and this requires -lpthread on
> Linux.
> Introduced NGX_LIBPTHREAD to add it as appropriate, similar to
> existing
> NGX_LIBDL.
>

Patch works beautifully for me.

Thanks Maxim!

I can not configure the python module through the official Nginx Unit documentation?

$
0
0
2018/03/13 12:10:37 [info] 2220#2220 "example_python" application started
2018/03/13 12:10:37 [emerg] 2220#2220 Python failed to import module "wsgi"
2018/03/13 12:10:37 [notice] 1625#1625 process 2220 exited with code 1
2018/03/13 12:10:37 [warn] 1632#1632 failed to start application "example_python"

Re: I can not configure the python module through the official Nginx Unit documentation?

$
0
0
On Tuesday 13 March 2018 11:46:48 avpdnepr wrote:
> 2018/03/13 12:10:37 [info] 2220#2220 "example_python" application started
> 2018/03/13 12:10:37 [emerg] 2220#2220 Python failed to import module "wsgi"
> 2018/03/13 12:10:37 [notice] 1625#1625 process 2220 exited with code 1
> 2018/03/13 12:10:37 [warn] 1632#1632 failed to start application
> "example_python"
>

This means that Python interpreter is unable to load your application.
You should check that the path is correct and Unit application process
have enough rights.

wbr, Valentin V. Bartenev

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

[njs] Handling the NJS_NATIVE_GETTER properties in a single place.

$
0
0
details: http://hg.nginx.org/njs/rev/9dcf4f92e32a
branches:
changeset: 455:9dcf4f92e32a
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Tue Mar 13 18:55:24 2018 +0300
description:
Handling the NJS_NATIVE_GETTER properties in a single place.

diffstat:

njs/njs_array.c | 5 +-
njs/njs_error.c | 5 +-
njs/njs_function.c | 5 +-
njs/njs_function.h | 3 +-
njs/njs_object.c | 32 +++++++++++--------
njs/njs_object.h | 9 +++-
njs/njs_regexp.c | 25 +++++++++------
njs/njs_string.c | 5 +-
njs/njs_vm.c | 76 ++++++++++++++++++++++++-----------------------
njs/njs_vm.h | 3 +-
njs/test/njs_unit_test.c | 9 +++++
11 files changed, 103 insertions(+), 74 deletions(-)

diffs (472 lines):

diff -r c86a0cc40ce5 -r 9dcf4f92e32a njs/njs_array.c
--- a/njs/njs_array.c Wed Feb 28 19:16:25 2018 +0300
+++ b/njs/njs_array.c Tue Mar 13 18:55:24 2018 +0300
@@ -381,9 +381,10 @@ const njs_object_init_t njs_array_const


static njs_ret_t
-njs_array_prototype_length(njs_vm_t *vm, njs_value_t *array)
+njs_array_prototype_length(njs_vm_t *vm, njs_value_t *array,
+ njs_value_t *retval)
{
- njs_value_number_set(&vm->retval, array->data.u.array->length);
+ njs_value_number_set(retval, array->data.u.array->length);

njs_release(vm, array);

diff -r c86a0cc40ce5 -r 9dcf4f92e32a njs/njs_error.c
--- a/njs/njs_error.c Wed Feb 28 19:16:25 2018 +0300
+++ b/njs/njs_error.c Tue Mar 13 18:55:24 2018 +0300
@@ -533,7 +533,8 @@ njs_memory_error_constructor(njs_vm_t *v


static njs_ret_t
-njs_memory_error_prototype_create(njs_vm_t *vm, njs_value_t *value)
+njs_memory_error_prototype_create(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval)
{
int32_t index;
njs_value_t *proto;
@@ -550,7 +551,7 @@ njs_memory_error_prototype_create(njs_vm
proto = (njs_value_t *) &njs_value_void;
}

- vm->retval = *proto;
+ *retval = *proto;

return NXT_OK;
}
diff -r c86a0cc40ce5 -r 9dcf4f92e32a njs/njs_function.c
--- a/njs/njs_function.c Wed Feb 28 19:16:25 2018 +0300
+++ b/njs/njs_function.c Tue Mar 13 18:55:24 2018 +0300
@@ -411,14 +411,15 @@ njs_function_call(njs_vm_t *vm, njs_inde
*/

njs_ret_t
-njs_function_prototype_create(njs_vm_t *vm, njs_value_t *value)
+njs_function_prototype_create(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval)
{
njs_value_t *proto;

proto = njs_function_property_prototype_create(vm, value);

if (nxt_fast_path(proto != NULL)) {
- vm->retval = *proto;
+ *retval = *proto;
return NXT_OK;
}

diff -r c86a0cc40ce5 -r 9dcf4f92e32a njs/njs_function.h
--- a/njs/njs_function.h Wed Feb 28 19:16:25 2018 +0300
+++ b/njs/njs_function.h Tue Mar 13 18:55:24 2018 +0300
@@ -146,7 +146,8 @@ struct njs_frame_s {
njs_function_t *njs_function_alloc(njs_vm_t *vm);
njs_function_t *njs_function_value_copy(njs_vm_t *vm, njs_value_t *value);
njs_native_frame_t *njs_function_frame_alloc(njs_vm_t *vm, size_t size);
-njs_ret_t njs_function_prototype_create(njs_vm_t *vm, njs_value_t *value);
+njs_ret_t njs_function_prototype_create(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval);
njs_value_t *njs_function_property_prototype_create(njs_vm_t *vm,
njs_value_t *value);
njs_ret_t njs_function_constructor(njs_vm_t *vm, njs_value_t *args,
diff -r c86a0cc40ce5 -r 9dcf4f92e32a njs/njs_object.c
--- a/njs/njs_object.c Wed Feb 28 19:16:25 2018 +0300
+++ b/njs/njs_object.c Tue Mar 13 18:55:24 2018 +0300
@@ -745,7 +745,7 @@ njs_object_get_prototype_of(njs_vm_t *vm
njs_index_t unused)
{
if (nargs > 1 && njs_is_object(&args[1])) {
- njs_object_prototype_get_proto(vm, &args[1]);
+ njs_object_prototype_get_proto(vm, &args[1], &vm->retval);
return NXT_OK;
}

@@ -976,7 +976,8 @@ njs_object_is_extensible(njs_vm_t *vm, n
*/

njs_ret_t
-njs_primitive_prototype_get_proto(njs_vm_t *vm, njs_value_t *value)
+njs_primitive_prototype_get_proto(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval)
{
nxt_uint_t index;
njs_object_t *proto;
@@ -993,9 +994,9 @@ njs_primitive_prototype_get_proto(njs_vm
proto = &vm->prototypes[index].object;
}

- vm->retval.data.u.object = proto;
- vm->retval.type = proto->type;
- vm->retval.data.truth = 1;
+ retval->data.u.object = proto;
+ retval->type = proto->type;
+ retval->data.truth = 1;

return NXT_OK;
}
@@ -1008,7 +1009,8 @@ njs_primitive_prototype_get_proto(njs_vm
*/

njs_ret_t
-njs_object_prototype_create(njs_vm_t *vm, njs_value_t *value)
+njs_object_prototype_create(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval)
{
int32_t index;
njs_value_t *proto;
@@ -1027,7 +1029,7 @@ njs_object_prototype_create(njs_vm_t *vm
proto = (njs_value_t *) &njs_value_void;
}

- vm->retval = *proto;
+ *retval = *proto;

return NXT_OK;
}
@@ -1205,19 +1207,20 @@ const njs_object_init_t njs_object_cons


njs_ret_t
-njs_object_prototype_get_proto(njs_vm_t *vm, njs_value_t *value)
+njs_object_prototype_get_proto(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval)
{
njs_object_t *proto;

proto = value->data.u.object->__proto__;

if (nxt_fast_path(proto != NULL)) {
- vm->retval.data.u.object = proto;
- vm->retval.type = proto->type;
- vm->retval.data.truth = 1;
+ retval->data.u.object = proto;
+ retval->type = proto->type;
+ retval->data.truth = 1;

} else {
- vm->retval = njs_value_null;
+ *retval = njs_value_null;
}

return NXT_OK;
@@ -1231,7 +1234,8 @@ njs_object_prototype_get_proto(njs_vm_t
*/

static njs_ret_t
-njs_object_prototype_create_constructor(njs_vm_t *vm, njs_value_t *value)
+njs_object_prototype_create_constructor(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval)
{
int32_t index;
njs_value_t *cons;
@@ -1267,7 +1271,7 @@ found:
cons = njs_property_constructor_create(vm, &prototype->object.hash,
&vm->scopes[NJS_SCOPE_GLOBAL][index]);
if (nxt_fast_path(cons != NULL)) {
- vm->retval = *cons;
+ *retval = *cons;
return NXT_OK;
}

diff -r c86a0cc40ce5 -r 9dcf4f92e32a njs/njs_object.h
--- a/njs/njs_object.h Wed Feb 28 19:16:25 2018 +0300
+++ b/njs/njs_object.h Tue Mar 13 18:55:24 2018 +0300
@@ -51,11 +51,14 @@ njs_ret_t njs_object_constructor(njs_vm_
nxt_uint_t nargs, njs_index_t unused);
njs_object_prop_t *njs_object_prop_alloc(njs_vm_t *vm, const njs_value_t *name,
const njs_value_t *value, uint8_t attributes);
-njs_ret_t njs_primitive_prototype_get_proto(njs_vm_t *vm, njs_value_t *value);
-njs_ret_t njs_object_prototype_create(njs_vm_t *vm, njs_value_t *value);
+njs_ret_t njs_primitive_prototype_get_proto(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval);
+njs_ret_t njs_object_prototype_create(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval);
njs_value_t *njs_property_prototype_create(njs_vm_t *vm, nxt_lvlhsh_t *hash,
njs_object_t *prototype);
-njs_ret_t njs_object_prototype_get_proto(njs_vm_t *vm, njs_value_t *value);
+njs_ret_t njs_object_prototype_get_proto(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval);
njs_value_t *njs_property_constructor_create(njs_vm_t *vm, nxt_lvlhsh_t *hash,
njs_value_t *constructor);
njs_ret_t njs_object_prototype_to_string(njs_vm_t *vm, njs_value_t *args,
diff -r c86a0cc40ce5 -r 9dcf4f92e32a njs/njs_regexp.c
--- a/njs/njs_regexp.c Wed Feb 28 19:16:25 2018 +0300
+++ b/njs/njs_regexp.c Tue Mar 13 18:55:24 2018 +0300
@@ -474,7 +474,8 @@ njs_regexp_alloc(njs_vm_t *vm, njs_regex


static njs_ret_t
-njs_regexp_prototype_last_index(njs_vm_t *vm, njs_value_t *value)
+njs_regexp_prototype_last_index(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval)
{
uint32_t index;
njs_regexp_t *regexp;
@@ -487,19 +488,20 @@ njs_regexp_prototype_last_index(njs_vm_t
(void) njs_string_prop(&string, &regexp->string);

index = njs_string_index(&string, regexp->last_index);
- njs_value_number_set(&vm->retval, index);
+ njs_value_number_set(retval, index);

return NXT_OK;
}


static njs_ret_t
-njs_regexp_prototype_global(njs_vm_t *vm, njs_value_t *value)
+njs_regexp_prototype_global(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval)
{
njs_regexp_pattern_t *pattern;

pattern = value->data.u.regexp->pattern;
- vm->retval = pattern->global ? njs_value_true : njs_value_false;
+ *retval = pattern->global ? njs_value_true : njs_value_false;
njs_release(vm, value);

return NXT_OK;
@@ -507,12 +509,13 @@ njs_regexp_prototype_global(njs_vm_t *vm


static njs_ret_t
-njs_regexp_prototype_ignore_case(njs_vm_t *vm, njs_value_t *value)
+njs_regexp_prototype_ignore_case(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval)
{
njs_regexp_pattern_t *pattern;

pattern = value->data.u.regexp->pattern;
- vm->retval = pattern->ignore_case ? njs_value_true : njs_value_false;
+ *retval = pattern->ignore_case ? njs_value_true : njs_value_false;
njs_release(vm, value);

return NXT_OK;
@@ -520,12 +523,13 @@ njs_regexp_prototype_ignore_case(njs_vm_


static njs_ret_t
-njs_regexp_prototype_multiline(njs_vm_t *vm, njs_value_t *value)
+njs_regexp_prototype_multiline(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval)
{
njs_regexp_pattern_t *pattern;

pattern = value->data.u.regexp->pattern;
- vm->retval = pattern->multiline ? njs_value_true : njs_value_false;
+ *retval = pattern->multiline ? njs_value_true : njs_value_false;
njs_release(vm, value);

return NXT_OK;
@@ -533,7 +537,8 @@ njs_regexp_prototype_multiline(njs_vm_t


static njs_ret_t
-njs_regexp_prototype_source(njs_vm_t *vm, njs_value_t *value)
+njs_regexp_prototype_source(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval)
{
u_char *source;
int32_t length;
@@ -547,7 +552,7 @@ njs_regexp_prototype_source(njs_vm_t *vm
size = strlen((char *) source) - pattern->flags;
length = nxt_utf8_length(source, size);

- return njs_regexp_string_create(vm, &vm->retval, source, size, length);
+ return njs_regexp_string_create(vm, retval, source, size, length);
}


diff -r c86a0cc40ce5 -r 9dcf4f92e32a njs/njs_string.c
--- a/njs/njs_string.c Wed Feb 28 19:16:25 2018 +0300
+++ b/njs/njs_string.c Tue Mar 13 18:55:24 2018 +0300
@@ -434,7 +434,8 @@ const njs_object_init_t njs_string_cons


static njs_ret_t
-njs_string_prototype_length(njs_vm_t *vm, njs_value_t *value)
+njs_string_prototype_length(njs_vm_t *vm, njs_value_t *value,
+ njs_value_t *retval)
{
size_t size;
uintptr_t length;
@@ -461,7 +462,7 @@ njs_string_prototype_length(njs_vm_t *vm
length = (length == 0) ? size : length;
}

- njs_value_number_set(&vm->retval, length);
+ njs_value_number_set(retval, length);

njs_release(vm, value);

diff -r c86a0cc40ce5 -r 9dcf4f92e32a njs/njs_vm.c
--- a/njs/njs_vm.c Wed Feb 28 19:16:25 2018 +0300
+++ b/njs/njs_vm.c Tue Mar 13 18:55:24 2018 +0300
@@ -53,6 +53,10 @@

typedef struct {
nxt_lvlhsh_query_t lhq;
+
+ /* scratch is used to get the value of an NJS_NATIVE_GETTER property. */
+ njs_object_prop_t scratch;
+
njs_value_t value;
njs_object_t *prototype;
uint8_t query;
@@ -561,15 +565,6 @@ njs_vmcode_property_get(njs_vm_t *vm, nj
retval = &prop->value;
break;

- case NJS_NATIVE_GETTER:
- ret = prop->value.data.u.getter(vm, object);
-
- if (nxt_fast_path(ret == NXT_OK)) {
- return sizeof(njs_vmcode_prop_get_t);
- }
-
- return ret;
-
default:
nxt_thread_log_alert("invalid property get type:%d", prop->type);

@@ -1168,6 +1163,7 @@ njs_object_property_query(njs_vm_t *vm,

if (prop->type != NJS_WHITEOUT) {
pq->shared = 0;
+
return ret;
}

@@ -1183,13 +1179,31 @@ njs_object_property_query(njs_vm_t *vm,

if (ret == NXT_OK) {
pq->shared = 1;
-
- if (pq->query == NJS_PROPERTY_QUERY_IN) {
+ prop = pq->lhq.value;
+
+ switch (pq->query) {
+ case NJS_PROPERTY_QUERY_GET:
+ if (prop->type == NJS_NATIVE_GETTER) {
+ pq->scratch = *prop;
+ prop = &pq->scratch;
+ ret = prop->value.data.u.getter(vm, value, &prop->value);
+
+ if (nxt_fast_path(ret == NXT_OK)) {
+ prop->type = NJS_PROPERTY;
+ pq->lhq.value = prop;
+ }
+ }
+
+ break;
+
+ case NJS_PROPERTY_QUERY_IN:
prop = pq->lhq.value;

if (prop->type == NJS_WHITEOUT) {
return NXT_DECLINED;
}
+
+ break;
}

return ret;
@@ -1361,12 +1375,14 @@ njs_ret_t
njs_vmcode_instance_of(njs_vm_t *vm, njs_value_t *object,
njs_value_t *constructor)
{
- nxt_int_t ret;
- njs_value_t *value;
- njs_object_t *prototype, *proto;
- njs_object_prop_t *prop;
- const njs_value_t *retval;
- nxt_lvlhsh_query_t lhq;
+ nxt_int_t ret;
+ njs_value_t *value;
+ njs_object_t *prototype, *proto;
+ njs_object_prop_t *prop;
+ const njs_value_t *retval;
+ njs_property_query_t pq;
+
+ static njs_value_t prototype_string = njs_string("prototype");

if (!njs_is_function(constructor)) {
njs_exception_type_error(vm, "right argument is not a function", NULL);
@@ -1376,28 +1392,14 @@ njs_vmcode_instance_of(njs_vm_t *vm, njs
retval = &njs_value_false;

if (njs_is_object(object)) {
-
- lhq.key_hash = NJS_PROTOTYPE_HASH;
- lhq.key = nxt_string_value("prototype");
-
- prop = njs_object_property(vm, constructor->data.u.object, &lhq);
-
- if (prop != NULL) {
+ pq.query = NJS_PROPERTY_QUERY_GET;
+
+ ret = njs_property_query(vm, &pq, constructor, &prototype_string);
+
+ if (nxt_fast_path(ret == NXT_OK)) {
+ prop = pq.lhq.value;
value = &prop->value;

- if (prop->type == NJS_NATIVE_GETTER) {
- /*
- * STUB: getter should be called by some njs_object_property()
- */
- ret = prop->value.data.u.getter(vm, constructor);
-
- if (nxt_slow_path(ret != NXT_OK)) {
- return ret;
- }
-
- value = &vm->retval;
- }
-
/* TODO: test prop->value is object. */

prototype = value->data.u.object;
diff -r c86a0cc40ce5 -r 9dcf4f92e32a njs/njs_vm.h
--- a/njs/njs_vm.h Wed Feb 28 19:16:25 2018 +0300
+++ b/njs/njs_vm.h Tue Mar 13 18:55:24 2018 +0300
@@ -117,7 +117,8 @@ typedef enum {

typedef struct njs_parser_s njs_parser_t;

-typedef njs_ret_t (*njs_getter_t) (njs_vm_t *vm, njs_value_t *obj);
+typedef njs_ret_t (*njs_getter_t) (njs_vm_t *vm, njs_value_t *obj,
+ njs_value_t *retval);
typedef njs_ret_t (*njs_function_native_t) (njs_vm_t *vm, njs_value_t *args,
nxt_uint_t nargs, njs_index_t retval);

diff -r c86a0cc40ce5 -r 9dcf4f92e32a njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c Wed Feb 28 19:16:25 2018 +0300
+++ b/njs/test/njs_unit_test.c Tue Mar 13 18:55:24 2018 +0300
@@ -5724,9 +5724,15 @@ static njs_unit_test_t njs_test[] =
{ nxt_string("({}).constructor === Object"),
nxt_string("true") },

+ { nxt_string("({}).constructor()"),
+ nxt_string("[object Object]") },
+
{ nxt_string("var a = Object.__proto__; a()"),
nxt_string("undefined") },

+ { nxt_string("Object.__proto__()"),
+ nxt_string("undefined") },
+
{ nxt_string("var a = Array(3); a"),
nxt_string(",,") },

@@ -5793,6 +5799,9 @@ static njs_unit_test_t njs_test[] =
{ nxt_string("[].constructor === Array"),
nxt_string("true") },

+ { nxt_string("([]).constructor()"),
+ nxt_string("") },
+
{ nxt_string("Boolean()"),
nxt_string("false") },

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Re: I can not configure the python module through the official Nginx Unit documentation?

$
0
0
Valentin V. Bartenev Wrote:
-------------------------------------------------------
> On Tuesday 13 March 2018 11:46:48 avpdnepr wrote:
> > 2018/03/13 12:10:37 [info] 2220#2220 "example_python" application
> started
> > 2018/03/13 12:10:37 [emerg] 2220#2220 Python failed to import module
> "wsgi"
> > 2018/03/13 12:10:37 [notice] 1625#1625 process 2220 exited with code
> 1
> > 2018/03/13 12:10:37 [warn] 1632#1632 failed to start application
> > "example_python"
> >
>
> This means that Python interpreter is unable to load your application.
> You should check that the path is correct and Unit application process
> have enough rights.
>
> wbr, Valentin V. Bartenev
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

root 1625 0.0 0.0 22632 2212 ? Ss 11:48 0:00 unit: main [/usr/sbin/unitd --log /var/log/unit.log --pid /run/unit.pid]
nobody 1631 0.0 0.0 32744 2072 ? S 11:48 0:00 unit: controller
nobody 1632 0.0 0.0 106736 2176 ? Sl 11:48 0:00 unit: router
www-php 1633 0.0 0.3 129272 15056 ? S 11:48 0:00 unit: "blogs" application
www-php 1634 0.0 0.3 129276 15112 ? S 11:48 0:00 unit: "blogs" application
www-php 1635 0.0 0.3 129276 15112 ? S 11:48 0:00 unit: "blogs" application
www-php 1636 0.0 0.3 129276 15112 ? S 11:48 0:00 unit: "blogs" application
www-php 1637 0.0 0.3 129276 15116 ? S 11:48 0:00 unit: "blogs" application
www-php 1638 0.0 0.3 129276 15112 ? S 11:48 0:00 unit: "blogs" application
www-php 1639 0.0 0.3 129276 15116 ? S 11:48 0:00 unit: "blogs" application
www-php 1640 0.0 0.3 129276 15112 ? S 11:48 0:00 unit: "blogs" application
www-php 1641 0.0 0.3 129276 15116 ? S 11:48 0:00 unit: "blogs" application
www-php 1642 0.0 0.3 129276 15120 ? S 11:48 0:00 unit: "blogs" application
www-php 1643 0.0 0.3 129276 15120 ? S 11:48 0:00 unit: "blogs" application
www-php 1644 0.0 0.3 129276 15120 ? S 11:48 0:00 unit: "blogs" application
www-php 1645 0.0 0.3 129276 15120 ? S 11:48 0:00 unit: "blogs" application
www-php 1646 0.0 0.3 129276 15116 ? S 11:48 0:00 unit: "blogs" application
www-php 1647 0.0 0.3 129276 15116 ? S 11:48 0:00 unit: "blogs" application
www-php 1648 0.0 0.3 129276 15116 ? S 11:48 0:00 unit: "blogs" application
www-php 1649 0.0 0.3 129276 15116 ? S 11:48 0:00 unit: "blogs" application
www-php 1650 0.0 0.3 129276 15116 ? S 11:48 0:00 unit: "blogs" application
www-php 1651 0.0 0.3 129276 15116 ? S 11:48 0:00 unit: "blogs" application
www-php 1652 0.0 0.3 129280 15116 ? S 11:48 0:00 unit: "blogs" application
root 3910 0.0 0.0 12944 932 pts/0 S+ 16:24 0:00 grep --color=auto unit

Re: I can not configure the python module through the official Nginx Unit documentation?

$
0
0
{
"listeners": {
"*:8300": {
"application": "blogs"
},
"*:8301": {
"application": "cart"
}
},

"applications": {
"blogs": {
"type": "php",
"processes": 20,
"user": "www-php",
"group": "www-php",
"root": "/var/www",
"index": "index.php"
},
"cart": {
"type": "python",
"processes": 10,
"user": "root",
"group": "root",
"path": "/var/www/app"
}
}
}

Re: I can not configure the python module through the official Nginx Unit documentation?

$
0
0
On Tuesday 13 March 2018 12:28:00 avpdnepr wrote:
> {
> "listeners": {
> "*:8300": {
> "application": "blogs"
> },
> "*:8301": {
> "application": "cart"
> }
> },
>
> "applications": {
> "blogs": {
> "type": "php",
> "processes": 20,
> "user": "www-php",
> "group": "www-php",
> "root": "/var/www",
> "index": "index.php"
> },
> "cart": {
> "type": "python",
> "processes": 10,
> "user": "root",
> "group": "root",
> "path": "/var/www/app"
> }
> }
> }
>

Could you provide ls -l /var/www/app ?

Also in you Unit log the application was "example_python"
but in your configuration the only Python application is
called "cart".

wbr, Valentin V. Bartenev

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

Re: I can not configure the python module through the official Nginx Unit documentation?

$
0
0
root@instance-1:~# ls -l /var/www/app
total 0
root@instance-1:~#

Re: I can not configure the python module through the official Nginx Unit documentation?

$
0
0
On Tuesday 13 March 2018 12:43:10 avpdnepr wrote:
> root@instance-1:~# ls -l /var/www/app
> total 0
> root@instance-1:~#
>

So, you have no Python application in /var/www/app.
What are you trying to run then and where it is?

wbr, Valentin V. Bartenev

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

[njs] Removed unused null proto hash.

$
0
0
details: http://hg.nginx.org/njs/rev/6738ff52a2cb
branches:
changeset: 456:6738ff52a2cb
user: Igor Sysoev <igor@sysoev.ru>
date: Tue Mar 13 19:51:25 2018 +0300
description:
Removed unused null proto hash.

diffstat:

njs/njs_builtin.c | 12 ------------
njs/njs_object.c | 1 -
njs/njs_vm.c | 5 -----
njs/njs_vm.h | 1 -
4 files changed, 0 insertions(+), 19 deletions(-)

diffs (65 lines):

diff -r 9dcf4f92e32a -r 6738ff52a2cb njs/njs_builtin.c
--- a/njs/njs_builtin.c Tue Mar 13 18:55:24 2018 +0300
+++ b/njs/njs_builtin.c Tue Mar 13 19:51:25 2018 +0300
@@ -222,24 +222,12 @@ njs_builtin_objects_create(njs_vm_t *vm)
{ njs_memory_error_constructor, { NJS_SKIP_ARG, NJS_STRING_ARG } },
};

- static const njs_object_prop_t null_proto_property = {
- .type = NJS_WHITEOUT,
- .name = njs_string("__proto__"),
- .value = njs_value(NJS_NULL, 0, 0.0),
- };
-
static const njs_object_prop_t function_prototype_property = {
.type = NJS_NATIVE_GETTER,
.name = njs_string("prototype"),
.value = njs_native_getter(njs_function_prototype_create),
};

- ret = njs_object_hash_create(vm, &vm->shared->null_proto_hash,
- &null_proto_property, 1);
- if (nxt_slow_path(ret != NXT_OK)) {
- return NXT_ERROR;
- }
-
ret = njs_object_hash_create(vm, &vm->shared->function_prototype_hash,
&function_prototype_property, 1);
if (nxt_slow_path(ret != NXT_OK)) {
diff -r 9dcf4f92e32a -r 6738ff52a2cb njs/njs_object.c
--- a/njs/njs_object.c Tue Mar 13 18:55:24 2018 +0300
+++ b/njs/njs_object.c Tue Mar 13 19:51:25 2018 +0300
@@ -299,7 +299,6 @@ njs_object_create(njs_vm_t *vm, njs_valu
object->__proto__ = args[1].data.u.object;

} else {
- object->shared_hash = vm->shared->null_proto_hash;
object->__proto__ = NULL;
}

diff -r 9dcf4f92e32a -r 6738ff52a2cb njs/njs_vm.c
--- a/njs/njs_vm.c Tue Mar 13 18:55:24 2018 +0300
+++ b/njs/njs_vm.c Tue Mar 13 19:51:25 2018 +0300
@@ -1198,11 +1198,6 @@ njs_object_property_query(njs_vm_t *vm,

case NJS_PROPERTY_QUERY_IN:
prop = pq->lhq.value;
-
- if (prop->type == NJS_WHITEOUT) {
- return NXT_DECLINED;
- }
-
break;
}

diff -r 9dcf4f92e32a -r 6738ff52a2cb njs/njs_vm.h
--- a/njs/njs_vm.h Tue Mar 13 18:55:24 2018 +0300
+++ b/njs/njs_vm.h Tue Mar 13 19:51:25 2018 +0300
@@ -1022,7 +1022,6 @@ typedef struct {
struct njs_vm_shared_s {
nxt_lvlhsh_t keywords_hash;
nxt_lvlhsh_t values_hash;
- nxt_lvlhsh_t null_proto_hash;
nxt_lvlhsh_t function_prototype_hash;

njs_object_t objects[NJS_OBJECT_MAX];
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Re: One upstream connection blocks another upstream connection

$
0
0
Hello!

On Tue, Mar 13, 2018 at 12:39:05PM +0000, lje@napatech.com wrote:

> IБ─≥m investing a problem where I get delays in requests that is
> proxied to an upstream service.
> By looking at the debug log it seems that one request is
> blocking the worker so it canБ─≥t complete another requests.
>
> If you look at the log below request *352 is handled by worker
> 18728. This worker then starts to process request *360 but for
> reason it is blocked at 13:53:53 until 13:54:03. How can that
> happen ?
>
> The upstream service for request *360 doesnБ─≥t send any data in
> the time interval 13:53:53-15:54:03.
> But the upstream service for request *352 responses nearly
> immediately.
> (I have examined the communication between nginx and the
> upstream in wireshark)
>
> Another observation, in the time interval 13:53:53-15:54:03 the
> worker process seems to be in state D (uninterruptible sleep)
>
> So my question is: What can block worker 18728 so it doesnБ─≥t
> complete request *352
>
> OS: Redhat 7.4
> Nginx: 1.12.2
>
> Hopefully I have provided enough details.
>
> 2018/03/09 13:53:40 [debug] 18726#0: *249 input buf #95517
> 2018/03/09 13:53:32 [debug] 18728#0: *189 pipe temp offset: 588029952
> 2018/03/09 13:53:40 [debug] 18726#0: *249 input buf #95518
> 2018/03/09 13:53:32 [debug] 18728#0: *189 readv: eof:0, avail:1
> 2018/03/09 13:53:40 [debug] 18726#0: *249 pipe offset: 368738304
> 2018/03/09 13:53:32 [debug] 18728#0: *189 readv: 2, last:4096
> 2018/03/09 13:53:40 [debug] 18726#0: *249 pipe buf ls:1 0000556CF522BAF0, pos 0000556CF522BAF0, size: 4096
> 2018/03/09 13:53:40 [debug] 18726#0: *249 pipe buf ls:1 0000556CF5233250, pos 0000556CF5233250, size: 4096
> 2018/03/09 13:53:32 [debug] 18728#0: *189 pipe recv chain: 8192
> 2018/03/09 13:53:40 [debug] 18726#0: *249 pipe buf ls:1 0000556CF522EB20, pos 0000556CF522EB20, size: 4096
> 2018/03/09 13:53:32 [debug] 18728#0: *189 input buf #144060
> 2018/03/09 13:53:40 [debug] 18726#0: *249 size: 8192
> 2018/03/09 13:53:32 [debug] 18728#0: *189 input buf #144061
> 2018/03/09 13:53:40 [debug] 18726#0: *249 writev: 22, 8192, 368738304
> 2018/03/09 13:53:32 [debug] 18728#0: *189 pipe offset: 588029952
> 2018/03/09 13:53:32 [debug] 18728#0: *189 pipe buf ls:1 0000556CF5220480, pos 0000556CF5220480, size: 4096
> 2018/03/09 13:53:32 [debug] 18728#0: *189 pipe buf ls:1 0000556CF5233250, pos 0000556CF5233250, size: 4096
> 2018/03/09 13:53:40 [debug] 18726#0: *249 pipe temp offset: 368746496
> 2018/03/09 13:53:32 [debug] 18728#0: *189 pipe buf ls:1 0000556CF522CAF0, pos 0000556CF522CAF0, size: 4096
> 2018/03/09 13:53:53 [debug] 18729#0: *352 writev: 418 of 418
> 2018/03/09 13:53:40 [debug] 18726#0: *249 readv: eof:0, avail:1
> 2018/03/09 13:53:32 [debug] 18728#0: *189 size: 8192
> 2018/03/09 13:53:53 [debug] 18729#0: *352 chain writer out: 0000000000000000
> 2018/03/09 13:53:40 [debug] 18726#0: *249 readv: 2, last:4096
> 2018/03/09 13:53:53 [debug] 18729#0: *352 event timer del: 14: 1520603638051
> 2018/03/09 13:53:32 [debug] 18728#0: *189 writev: 18, 8192, 588029952
> 2018/03/09 13:53:53 [debug] 18729#0: *352 event timer add: 14: 86400000:1520690033051

Mix of different times in logs suggests that workers are blocked
for a long time doing something (and hence the time in some worker
process are not updated for a long time).

Reasons can be different, and more information/logs are needed to
say anything for sure. In this particular case my best guess is
that your backend server is much faster than the disk you use for
proxy_temp_path, and so nginx loops buffering a response to disk
for a long time. For example, the response in *189 already
buffered about 600M, and there is no indication in the log lines
quoted that it stopped reading from the upstream somewhere. At
the same time the process thinks current time is 13:53:32, which
is 21 seconds behind 13:53:53 as logged by pid 18729 at the same
time.

An obvious workaround would be to disable or limit disk buffering,
"proxy_max_temp_file_size 0;". Additionally, using larger memory
buffers (proxy_buffer_size, proxy_buffers) might help to avoid
such monopolization of a worker process.

See also https://trac.nginx.org/nginx/ticket/1431 for a detailed
explanation of a similar problem as observed with websocket
proxying.

[...]

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Re: I can not configure the python module through the official Nginx Unit documentation?

$
0
0
root@instance-1:~# cat /var/www/app/index.py
import sys

def application(environ, start_response):
body = sys.version.encode("utf-8")
status = "200 OK"
headers = [('Content-type','text/plain')]
start_response(status, headers)
return body


root@instance-1:~# curl -X PUT -d @/root/unit_json/start.json --unix-socket /var/run/control.unit.sock http://localhost/
{
"error": "Failed to apply new configuration."
}
root@instance-1:~#

Re: I can not configure the python module through the official Nginx Unit documentation?

$
0
0
root@instance-1:~# cat /root/unit_json/start.json
{
"listeners": {
"*:8300": {
"application": "blogs"
},
"*:8301": {
"application": "cart"
}
},

"applications": {
"blogs": {
"type": "php",
"processes": 20,
"user": "www-php",
"group": "www-php",
"root": "/var/www",
"index": "index.php"
},
"cart": {
"type": "python",
"processes": 10,
"module": "wsgi",
"user": "root",
"group": "root",
"path": "/var/www/app"
}
}
}
root@instance-1:~#

Handling URL with the percentage character

$
0
0
Hi,

Is there a way URL like

++++++++++++++++++++++++++++++++++++
http://domain.com/%product_cat%/myproduct
+++++++++++++++++++++++++++++++++++++

to be passed as is to an Apache proxy backend.

Currently, Nginx is throwing a 400 bad request error (which is correct),
but the Apache httpd using a php script can handle this . so is there a way
I can do like ..hey this will be handled someplace else so i just need to
pass on whatever i get to upstream?

Also if I encode the URL with

http://domain.com/%25product_cat%25/myproduct


That works too. So if the first is not possible is there a way to rewrite
all % to %25 ?


--
*Anoop P Alias*
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

[njs] Fixed 1 byte heap buffer overflow.

$
0
0
details: http://hg.nginx.org/njs/rev/8a274b5f1a04
branches:
changeset: 457:8a274b5f1a04
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Tue Mar 13 20:37:01 2018 +0300
description:
Fixed 1 byte heap buffer overflow.

diffstat:

njs/njs_vm.c | 4 ++--
njs/test/njs_unit_test.c | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 6738ff52a2cb -r 8a274b5f1a04 njs/njs_vm.c
--- a/njs/njs_vm.c Tue Mar 13 19:51:25 2018 +0300
+++ b/njs/njs_vm.c Tue Mar 13 20:37:01 2018 +0300
@@ -3514,11 +3514,11 @@ again:

for (i = 0; i < backtrace->items; i++) {
if (be[i].line != 0) {
- len += sizeof(" at (:)\n") - 1 + 10
+ len += sizeof(" at (:)\n") + 10
+ be[i].name.length;

} else {
- len += sizeof(" at (native)\n") - 1
+ len += sizeof(" at (native)\n")
+ be[i].name.length;
}
}
diff -r 6738ff52a2cb -r 8a274b5f1a04 njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c Tue Mar 13 19:51:25 2018 +0300
+++ b/njs/test/njs_unit_test.c Tue Mar 13 20:37:01 2018 +0300
@@ -5706,6 +5706,9 @@ static njs_unit_test_t njs_test[] =
{ nxt_string("Object.prototype.__proto__ === null"),
nxt_string("true") },

+ { nxt_string("Object.prototype.__proto__.f()"),
+ nxt_string("InternalError: method 'f' query failed:-1") },
+
{ nxt_string("Object.prototype.toString.call(Object.prototype)"),
nxt_string("[object Object]") },

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Re: I can not configure the python module through the official Nginx Unit documentation?

$
0
0
On Tuesday 13 March 2018 13:25:47 avpdnepr wrote:
> root@instance-1:~# cat /root/unit_json/start.json
> {
> "listeners": {
> "*:8300": {
> "application": "blogs"
> },
> "*:8301": {
> "application": "cart"
> }
> },
>
> "applications": {
> "blogs": {
> "type": "php",
> "processes": 20,
> "user": "www-php",
> "group": "www-php",
> "root": "/var/www",
> "index": "index.php"
> },
> "cart": {
> "type": "python",
> "processes": 10,
> "module": "wsgi",
> "user": "root",
> "group": "root",
> "path": "/var/www/app"
> }
> }
> }

Since your Python application() callable is inside the
/var/www/app/index.py file, then your module should
be called "index", not "wsgi".

See the Python documentation about how it works:
https://docs.python.org/3/tutorial/modules.html#the-module-search-path

wbr, Valentin V. Bartenev

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Viewing all 53287 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>