Skip to content

Commit 739e275

Browse files
author
Qasim Sarfraz
authored
Merge pull request #1 from eSailors/limit-cache-size
Make cache size configurable
2 parents a26559e + 6fec892 commit 739e275

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

files/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ http {
1212
keepalive_timeout 65;
1313
sendfile on;
1414

15-
proxy_cache_path /cache/cache levels=1:2 keys_zone=cache:16m inactive=1y use_temp_path=off;
15+
proxy_cache_path /cache/cache levels=1:2 keys_zone=cache:16m inactive=1y max_size=CACHE_MAX_SIZE use_temp_path=off;
1616
resolver RESOLVER valid=30s;
1717

1818
# this is necessary for us to be able to disable request buffering in all cases

files/startup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,16 @@ fi
3131
UPSTREAM_WITHOUT_PORT=$( echo ${UPSTREAM} | sed -r "s/.*:\/\/(.*):.*/\1/g")
3232
echo Using resolver $RESOLVER and $UPSTREAM [$(dig +short ${UPSTREAM_WITHOUT_PORT})] as upstream.
3333

34+
CACHE_MAX_SIZE=${CACHE_MAX_SIZE:-75g}
35+
echo Using cache max size $CACHE_MAX_SIZE
36+
3437
CONFIG=/usr/local/openresty/nginx/conf/nginx.conf
3538

3639
# Update nginx config
3740
sed -i -e s!UPSTREAM!"$UPSTREAM"!g $CONFIG
3841
sed -i -e s!PORT!"$PORT"!g $CONFIG
3942
sed -i -e s!RESOLVER!"$RESOLVER"!g $CONFIG
43+
sed -i -e s!CACHE_MAX_SIZE!"$CACHE_MAX_SIZE"!g $CONFIG
4044

4145
# setup ~/.aws directory
4246
AWS_FOLDER='/root/.aws'

0 commit comments

Comments
 (0)