forked from rstudio/redx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf.example
69 lines (54 loc) · 1.29 KB
/
nginx.conf.example
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
worker_processes 1;
error_log stderr notice;
daemon off;
env REDIS_HOST;
env REDIS_PORT;
env REDIS_PASSWORD;
events {
worker_connections 1024;
}
http {
lua_package_path ";;/opt/redx/src/lib/plugins/?.lua;/opt/redx/src/lib/?.lua;/opt/redx/conf/?.lua;/opt/redx/src/bin/?.lua";
resolver 8.8.8.8;
init_by_lua_file '/opt/redx/src/bin/init_redx.lua';
upstream fallback {
server localhost:7700;
}
server {
# API
listen 8081;
lua_code_cache off;
location / {
default_type application/json;
content_by_lua '
require("lapis").serve("api")
';
}
}
server {
# MAIN
listen 8080;
lua_code_cache off;
lua_need_request_body on;
proxy_read_timeout 300;
proxy_connect_timeout 3;
proxy_buffering off;
set $upstream 'fallback';
location / {
access_by_lua '
require("lapis").serve("main")
';
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for";
proxy_intercept_errors on;
error_page 504 502 = @fallback;
proxy_pass http:https://$upstream;
}
location @fallback {
proxy_pass http:https://fallback;
}
}
}