File tree 4 files changed +14
-2
lines changed
4 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ useradd --home-dir "${NGINX_BASE_PATH}" --no-create-home --no-user-group --uid 1
8
8
groupadd --gid 1000 nginx
9
9
10
10
mkdir -p \
11
- " ${NGINX_BASE_PATH} /cache" \
11
+ " ${NGINX_BASE_PATH} /cache/application" \
12
+ " ${NGINX_BASE_PATH} /cache/resources" \
12
13
" ${NGINX_BASE_PATH} /etc" \
13
14
" ${NGINX_BASE_PATH} /modules" \
14
15
" ${NGINX_BASE_PATH} /sbin" \
Original file line number Diff line number Diff line change 243
243
${addHeaderStrictTransportSecurity}
244
244
proxy_pass ${BEACH_ASSET_PROXY_ENDPOINT} /\$ 1\$ is_args\$ args?reqid=\$ request_id;
245
245
expires ${NGINX_STATIC_FILES_LIFETIME} ;
246
+ proxy_cache persistent_res;
247
+ # we care only about the resource hash as it's the only thing passed on, host is irrelevant
248
+ proxy_cache_key \$ 1;
249
+ add_header X-Nginx-Cache-Resources \$ upstream_cache_status;
246
250
}
247
251
EOM
248
252
elif [ -n " ${BEACH_GOOGLE_CLOUD_STORAGE_PUBLIC_BUCKET} " ]; then
260
264
${addHeaderStrictTransportSecurity}
261
265
proxy_pass https://storage.googleapis.com/${BEACH_GOOGLE_CLOUD_STORAGE_PUBLIC_BUCKET} /\$ 1\$ is_args\$ args?reqid=\$ request_id;
262
266
expires ${NGINX_STATIC_FILES_LIFETIME} ;
267
+ proxy_cache persistent_res;
268
+ # we care only about the resource hash as it's the only thing passed on, host is irrelevant
269
+ proxy_cache_key \$ 1;
270
+ add_header X-Nginx-Cache-Resources \$ upstream_cache_status;
263
271
}
264
272
EOM
265
273
elif [ -n " ${BEACH_PERSISTENT_RESOURCES_FALLBACK_BASE_URI} " ]; then
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ export NGINX_ACCESS_LOG_MODE="${NGINX_ACCESS_LOG_MODE:-dynamic}"
30
30
export NGINX_ACCESS_LOG_FORMAT="${NGINX_ACCESS_LOG_FORMAT:-default}"
31
31
export NGINX_ACCESS_LOG_IGNORED_STATUS_CODES_REGEX="${NGINX_ACCESS_LOG_IGNORED_STATUS_CODES_REGEX:-^[13]}"
32
32
33
- export NGINX_CACHE_PATH="${NGINX_CACHE_PATH:-${NGINX_BASE_PATH}/cache}"
33
+ export NGINX_CACHE_PATH="${NGINX_CACHE_PATH:-${NGINX_BASE_PATH}/cache/application }"
34
34
export NGINX_CACHE_ENABLE="${NGINX_CACHE_ENABLE:-no}"
35
35
export NGINX_CACHE_NAME="${NGINX_CACHE_NAME:-application}"
36
36
export NGINX_CACHE_DEFAULT_LIFETIME="${NGINX_CACHE_DEFAULT_LIFETIME:-5s}"
@@ -39,6 +39,8 @@ export NGINX_CACHE_INACTIVE="${NGINX_CACHE_INACTIVE:-1h}"
39
39
export NGINX_CACHE_USE_STALE_OPTIONS="${NGINX_CACHE_USE_STALE_OPTIONS:-updating error timeout invalid_header}"
40
40
export NGINX_CACHE_BACKGROUND_UPDATE="${NGINX_CACHE_BACKGROUND_UPDATE:-off}"
41
41
42
+ export NGINX_CACHE_RESOURCES_PATH="${NGINX_CACHE_PATH:-${NGINX_BASE_PATH}/cache/resources}"
43
+
42
44
export NGINX_CUSTOM_ERROR_PAGE_CODES="${NGINX_CUSTOM_ERROR_PAGE_CODES:-500 501 502 503}"
43
45
export NGINX_CUSTOM_ERROR_PAGE_TARGET="${NGINX_CUSTOM_ERROR_PAGE_TARGET:-}"
44
46
Original file line number Diff line number Diff line change 19
19
scgi_temp_path "${NGINX_TMP_PATH}/scgi" 1 2;
20
20
uwsgi_temp_path "${NGINX_TMP_PATH}/uwsgi" 1 2;
21
21
fastcgi_cache_path "${NGINX_CACHE_PATH}" levels=1:2 keys_zone=application:10m max_size=${NGINX_CACHE_MAX_SIZE};
22
+ proxy_cache_path "${NGINX_CACHE_RESOURCES_PATH}" levels=1:2 keys_zone=persistent_res:2m max_size=2g inactive=336h use_temp_path=off;
22
23
23
24
include ${NGINX_CONF_PATH}/mime.types;
24
25
default_type application/octet-stream;
You can’t perform that action at this time.
0 commit comments