lua-counter example

Hex Artifact Content
anonymous

Hex Artifact Content

Artifact 5f43526ccee57c433a11a125f34b67592020eb80704080ae53a79eac8c69047b:


0000: 6c 6f 63 61 74 69 6f 6e 20 3d 20 2f 70 6f 73 74  location = /post
0010: 67 72 65 73 20 7b 0a 09 69 6e 74 65 72 6e 61 6c  gres {..internal
0020: 3b 0a 09 70 6f 73 74 67 72 65 73 5f 71 75 65 72  ;..postgres_quer
0030: 79 20 24 65 63 68 6f 5f 72 65 71 75 65 73 74 5f  y $echo_request_
0040: 62 6f 64 79 3b 0a 09 70 6f 73 74 67 72 65 73 5f  body;..postgres_
0050: 70 61 73 73 20 63 6f 75 6e 74 65 72 3b 0a 7d 0a  pass counter;.}.
0060: 0a 6c 6f 63 61 74 69 6f 6e 20 3d 20 2f 63 6f 75  .location = /cou
0070: 6e 74 65 72 20 7b 0a 09 64 65 66 61 75 6c 74 5f  nter {..default_
0080: 74 79 70 65 20 61 70 70 6c 69 63 61 74 69 6f 6e  type application
0090: 2f 6a 73 6f 6e 3b 0a 09 75 73 65 72 69 64 20 6f  /json;..userid o
00a0: 6e 3b 0a 09 75 73 65 72 69 64 5f 6e 61 6d 65 20  n;..userid_name 
00b0: 75 69 64 3b 0a 09 75 73 65 72 69 64 5f 65 78 70  uid;..userid_exp
00c0: 69 72 65 73 20 33 36 35 64 3b 0a 09 75 73 65 72  ires 365d;..user
00d0: 69 64 5f 70 33 70 20 27 70 6f 6c 69 63 79 72 65  id_p3p 'policyre
00e0: 66 3d 22 2f 77 33 63 2f 70 33 70 2e 78 6d 6c 22  f="/w3c/p3p.xml"
00f0: 2c 20 43 50 3d 22 4e 4f 49 20 43 55 52 20 41 44  , CP="NOI CUR AD
0100: 4d 20 50 53 41 20 4f 55 52 20 53 54 50 20 53 54  M PSA OUR STP ST
0110: 41 22 27 3b 0a 0a 09 63 6f 6e 74 65 6e 74 5f 62  A"';...content_b
0120: 79 5f 6c 75 61 5f 66 69 6c 65 20 27 2f 68 6f 6d  y_lua_file '/hom
0130: 65 2f 61 72 63 61 64 65 2f 77 6f 72 6b 2f 61 64  e/arcade/work/ad
0140: 6d 69 6e 2f 6e 67 69 6e 78 2f 63 6f 75 6e 74 65  min/nginx/counte
0150: 72 2e 63 6f 6e 74 65 6e 74 2e 6c 75 61 27 3b 0a  r.content.lua';.
0160: 09 23 6c 6f 67 5f 62 79 5f 6c 75 61 5f 66 69 6c  .#log_by_lua_fil
0170: 65 20 27 2f 68 6f 6d 65 2f 61 72 63 61 64 65 2f  e '/home/arcade/
0180: 77 6f 72 6b 2f 61 64 6d 69 6e 2f 6e 67 69 6e 78  work/admin/nginx
0190: 2f 63 6f 75 6e 74 65 72 2e 6c 6f 67 2e 6c 75 61  /counter.log.lua
01a0: 27 3b 0a 09 65 78 70 69 72 65 73 20 65 70 6f 63  ';..expires epoc
01b0: 68 3b 0a 7d 0a                                   h;.}.