-
Notifications
You must be signed in to change notification settings - Fork 3
/
colore.nginx.conf
76 lines (69 loc) · 2.14 KB
/
colore.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
# vim: ft=nginx
#
# Sample nginx configuration for the colore application and another
# example application consuming its services.
#
set $colore_app /home/apps/colore/current;
set $colore_storage /home/apps/colore/storage;
set $foobar_app /home/apps/foobar/current;
#
# Colore application
#
http {
listen 80;
server_name colore.example.org;
root $colore_app/public;
try_files $uri $uri/ @colore_app;
#
# Only useful for debugging. This would make the storage directory
# open to requests from the outside world, and we don't want this.
#
# Documents access is maintained by web apps, that do authorization
# checks AND if those are successful, they are expected to emit an
# X-Accel-Redirect to the colore path. See below.
#
#location ~ /debug/(?<app>.+?)/(?<doc_id>.+?)/(?<file>.+)$ {
# set_colore_subdir $hash $doc_id 2;
# alias $colore_storage/$app/$hash/$doc_id/$file;
#}
#
# Colore App Server.
#
location @colore_app {
access_log /var/log/nginx/colore.app-access.log;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host
proxy_pass http://localhost:4567; # Adjust this
}
}
#
# Example "Foobar" application
#
http {
listen 80;
server_name foobar.example.org;
root $foobar_app/public;
try_files $uri $uri/ @foobar_app
#
# Colore endpoint. It is expected that the Foobar app emits
# HTTP responses with X-Accel-Redirect: /document/foobar/..
# Those will be catched by this configuration block and the
# file contents served directly by nginx.
#
location /document/foobar/(?<doc_id>.+?)/(?<file>.+)$ {
internal;
access_log /var/log/nginx/foobar.colore-access.log;
set_colore_subdir $hash $doc_id 2;
alias $colore_storage/foobar/$hash/$doc_id/$file;
error_page 404 /404.html;
}
#
# Foobar App Server.
#
location @foobar_app {
access_log /var/log/nginx/foobar.app-access.log;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host
proxy_pass http://localhost:3000; # Adjust this
}
}