-
Notifications
You must be signed in to change notification settings - Fork 4
/
nginx.conf
93 lines (74 loc) · 2.46 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
worker_processes auto;
pid /run/nginx.pid;
daemon off;
events {
worker_connections 2000;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_names_hash_bucket_size 64;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /dev/stdout;
error_log /dev/stdout;
# This server is used internally by mod_zip to access the file content
# which is stored on S3.
server {
listen 3333;
location / {
resolver 8.8.8.8 valid=30s;
resolver_timeout 10s;
proxy_pass https://@[email protected];
aws_access_key @AWS_ACCESS_KEY_ID@;
aws_secret_key @AWS_SECRET_ACCESS_KEY@;
s3_bucket @AWS_BUCKET@;
proxy_set_header Authorization $s3_auth_token;
proxy_set_header x-amz-date $aws_date;
proxy_http_version 1.1;
proxy_hide_header x-amz-id-2;
proxy_hide_header x-amz-request-id;
proxy_hide_header Set-Cookie;
proxy_ignore_headers "Set-Cookie";
proxy_buffering off;
proxy_intercept_errors on;
}
}
# This server serves static pages from the filesystem, but it adds the
# extra header 'X-Archive-Files', which is used to trigger mod_zip.
# Normally, you would use a dynamic backend (PHP, Python, etc.) to
# create these files.
server {
listen 8080;
location / {
alias /var/www/html/;
# add this header to trigger mod_zip
add_header X-Archive-Files 'zip';
# add this header to let the client download this as example.zip
add_header Content-Disposition 'attachment; filename=example.zip';
}
}
server {
listen 80;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_buffering off;
proxy_intercept_errors on;
# Hide the mod_zip header from the client, it is only used
# within nginx to trigger the mod_zip code.
proxy_hide_header X-Archive-Files;
}
location ~ "^/s3/(?<url>.*)$" {
internal;
proxy_pass http://127.0.0.1:3333/$url;
proxy_http_version 1.1;
proxy_buffering off;
proxy_intercept_errors on;
}
}
}
# vim: set ft=nginx ts=4 sts=4 sw=4 et: