-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnginx.conf
87 lines (72 loc) · 2.93 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
# ResourceYearPermission config example:
# display_name=Internet WWW11, access_url=http://localhost:8080/internet/www11, path=internet/www11, year=2015
server {
listen 8000;
listen [::]:8000;
server_name localhost;
client_max_body_size 32M;
location / {
proxy_pass http://django:8000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location = /resource_auth/ {
internal; # disallow external access to this endpoint
proxy_pass http://django:8000/resource_auth/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Original-URI $request_uri;
proxy_set_header Content-Length "";
proxy_pass_request_body off;
}
}
location /static {
alias /usr/share/nginx/static/;
}
location /media {
alias /usr/share/nginx/media/;
}
location /uploads {
internal; # only allow access through X-Accel-Redirect
alias /usr/share/nginx/uploads/;
}
location @handle_auth_unauthorized {
if ($auth_redirect) {
return 302 $auth_redirect;
}
return 401;
}
location @handle_auth_forbidden {
return 403;
}
location /internety {
alias /usr/share/nginx/internety/;
index index.html index.htm;
autoindex on;
auth_request /resource_auth/;
auth_request_set $auth_redirect $upstream_http_location;
error_page 401 = @handle_auth_unauthorized;
error_page 403 = @handle_auth_forbidden;
disable_symlinks on;
# Earlier internets don't have any specific configuration
location /internety/www14/ {
# We need to fix the paths because a lot of things were specified relative to / ¯\_(ツ)_/¯
sub_filter 'href="/' 'href="/internety/www14/';
sub_filter 'src="/' 'src="/internety/www14/';
sub_filter 'href=\\"/' 'href=\\"/internety/www14/';
sub_filter 'src=\\"/' 'src=\\"/internety/www14/';
sub_filter 'Index of /internety/www14/' 'Index of /'; # required for the scripts to correctly detect the root index page
sub_filter_once off;
sub_filter_types text/plain; # text/html is always included, but we also need to process the cancer1.txt and cancer2.txt files
# Our magical header/footer config
location ~* ^/internety/www14.*/$ {
add_before_body /internety/www14/cancer1.txt;
add_after_body /internety/www14/cancer2.txt;
}
}
# I don't have WWW15 files to test but it will be almost identical to WWW14
}
}