forked from cosyverif/server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
91 lines (80 loc) · 2.14 KB
/
nginx.conf
File metadata and controls
91 lines (80 loc) · 2.14 KB
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
worker_processes ${{NUM_WORKERS}};
error_log stderr notice;
daemon off;
pid logs/nginx.pid;
env NPROC;
env DOCKERCLOUD_SERVICE_API_URL; # docker-cloud specific
env WERCKER_GIT_BRANCH; # wercker specific
env REDIS_PORT;
env POSTGRES_PORT;
env POSTGRES_USER;
env POSTGRES_PASSWORD;
env POSTGRES_DATABASE;
env COSY_BRANCH;
env POSTGRES_USER;
env POSTGRES_PASSWORD;
env POSTGRES_DATABASE;
env AUTH0_DOMAIN;
env AUTH0_ID;
env AUTH0_SECRET;
env AUTH0_TOKEN;
env DOCKER_USER;
env DOCKER_SECRET;
events {
worker_connections 1024;
}
http {
include mime.types;
resolver "8.8.8.8" "4.4.4.4";
init_worker_by_lua_block {
local Config = require "lapis.config".get ()
local Qless = require "resty.qless"
local Worker = require "resty.qless.worker"
local worker = Worker.new (Config.redis)
worker:start {
interval = 1,
concurrency = 5,
reserver = "ordered",
queues = { "cosy" },
}
}
server {
server_name "${{HOST}}";
listen "${{PORT}}";
lua_code_cache "${{CODE_CACHE}}";
default_type "application/json";
keepalive_timeout 60;
lua_socket_log_errors off;
error_page 497 =200 $request_uri;
error_page 404 = @empty;
location @empty {
return 404 "{}";
}
location / {
default_type "application/json";
add_header "Access-Control-Allow-Origin" "*";
add_header "Access-Control-Allow-Credentials" true;
add_header "Access-Control-Allow-Methods" "DELETE, HEAD, GET, OPTIONS, POST, PUT";
add_header "Access-Control-Max-Age" 1728000;
content_by_lua_block {
require "resty.core"
require "lapis".serve "cosy.server"
}
}
location /lua {
root /;
default_type application/lua;
set $target "";
access_by_lua_block {
local name = ngx.var.uri:match "/lua/(.*)"
local filename = package.searchpath (name, package.path)
if filename then
ngx.var.target = filename
else
return ngx.exit (404)
end
}
try_files $target =404;
}
}
}