This repository has been archived by the owner on Dec 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
nginx.conf
139 lines (105 loc) · 2.34 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
worker_processes 1;
debug_points abort;
pid /tmp/nginx-js.pid;
error_log logs/error.log debug_http;
events { worker_connections 1024; }
http
{
include conf/mime.types;
default_type text/html;
js_maxmem 4M;
# js_utf8; # do not know why but it's broken
js_load 'js/nginx.js';
js_load "js/demos/handler.js";
js_require 'Handler.js';
# js_set Nginx.someVar 123;
js_set $js_set_string "function () { return 'bar1' }";
js_set $js_set_null "function () { return null }";
js_set $js_set_undefined "function () { return undefined }";
js_set $js_set_number "function () { return 123 }";
js_set $js_set_property "function (r) { return r.property = 'property' }";
js_set $msie6 '
function (r)
{
var ua = r.headersIn["User-Agent"]
if (/Opera/.test(ua))
return ""
if (/ MSIE [6-9]\.\d+/.test(ua))
return "1"
return "";
}
';
access_log off;
sendfile on;
keepalive_timeout 65;
server
{
listen 127.0.0.1:19090;
server_name _;
root html;
index index.html;
set $js_request_variables_a "abc";
set $js_request_variables_b "${js_request_variables_a}123";
set $js_request_variables_j "xx${js_set_string}xx";
set $js_request_variables_v "";
location / {}
location /demo/
{
js 'Handler.demo';
}
location = /demo/random
{
js 'function (r) { r.sendString(Math.random()); return Nginx.OK }';
}
location = /demo/msie6
{
if ($msie6)
{
return 404;
}
rewrite ^ /;
}
location = /demo/handler
{
js Hello.handler;
}
location /run/
{
js 'Handler.run';
}
location /run/request-body-file
{
client_body_in_file_only on;
js 'Handler.run';
}
location /run/access-path
{
js_access 'NginxTests.accessCheck';
js 'Handler.run';
}
location = /variable-set
{
rewrite ^ /run/variable-set?string=$js_set_string&null=$js_set_null&undefined=$js_set_undefined&number=$js_set_number&property=$js_set_property? last;
}
location /quick
{
return 403;
}
location /loopback/
{
proxy_pass http://127.0.0.1:19090/;
proxy_set_header Host "localhost";
# proxy_pass_header X-La-la-la;
}
location /rewrite/
{
rewrite "^/rewrite/(.*)$" /$1;
}
location /nginx.org
{
proxy_pass http://nginx.org/;
proxy_buffers 3 512K;
proxy_buffer_size 512K;
}
}
}