-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnginx.conf
37 lines (32 loc) · 1.27 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
http {
# Define the cache path for NGINX
# levels = number of characters in subdirectory names (/tmp/nginx/1/2a/)
# keys_zone = name of the cache : maximum size of the cache info (10mb)
# max_size = maximum size of the cache content (1gb)
# inactive = cache expiration time (60 minutes)
# use_temp_path = use extra space by writing to a temp directory before moving content --buito cache (off)
proxy_cache_path /tmp/nginx levels=1:2 keys_zone=shortener_cache:10m max_size=1g inactive=60m use_temp_path=off;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
location ~ /s/(.*)$ {
resolver 127.0.0.11 valid=15s;
proxy_set_header Host $host;
set $upstream http://app:8000;
proxy_pass $upstream;
rewrite /s/(.*) /find/$1 break;
}
location ~ /qr/(.*)$ {
proxy_cache shortener_cache;
proxy_cache_valid 200 60m;
add_header X-Cache-Status $upstream_cache_status;
resolver 127.0.0.11 valid=15s;
proxy_set_header Host $host;
set $upstream http://app:8000;
proxy_pass $upstream;
rewrite /qr/(.*) /qr/$1 break;
}
}
}
events { }