-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf.erb
66 lines (58 loc) · 2.21 KB
/
nginx.conf.erb
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
daemon off;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /run/nginx/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
proxy_cache_path /tmp/cache levels=1:2 keys_zone=S3_CACHE:10m inactive=48h max_size=4096m;
proxy_temp_path /tmp/cache/temp;
resolver 8.8.8.8 1.1.1.1 valid=300s ipv6=off;
resolver_timeout 10s;
server_tokens off;
client_max_body_size 32m;
keepalive_timeout 65;
sendfile on;
tcp_nodelay on;
gzip_vary on;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log warn;
server {
listen 8080 default_server;
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log warn;
location / {
include /etc/nginx/uwsgi_params;
uwsgi_param Host $host;
uwsgi_param X-Real-IP $remote_addr;
uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
uwsgi_param X-Forwareded-Proto $http_x_forwarded-proto;
uwsgi_pass <%= ENV['VIAFIER_UPSTREAM'] %>;
}
location ~* ^/(static/.*) {
proxy_http_version 1.1;
proxy_set_header Host '<%= ENV['VIAFIER_STATIC_S3_URL'] %>';
proxy_set_header Authorization '';
proxy_set_header Connection '';
proxy_hide_header x-amz-request-id;
proxy_hide_header Set-Cookie;
proxy_ignore_headers "Set-Cookie";
proxy_intercept_errors on;
proxy_cache S3_CACHE;
proxy_cache_valid 200 48h;
proxy_cache_valid 403 15m;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_lock on;
proxy_cache_bypass $http_cache_purge;
add_header Cache-Control max-age=31536000;
add_header X-Cache-Status $upstream_cache_status;
proxy_pass https://<%= ENV['VIAFIER_STATIC_S3_URL'] %>/$1;
}
}
}