File tree Expand file tree Collapse file tree 4 files changed +14
-2
lines changed
Expand file tree Collapse file tree 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
88groupadd --gid 1000 nginx
99
1010mkdir -p \
11- " ${NGINX_BASE_PATH} /cache" \
11+ " ${NGINX_BASE_PATH} /cache/application" \
12+ " ${NGINX_BASE_PATH} /cache/resources" \
1213 " ${NGINX_BASE_PATH} /etc" \
1314 " ${NGINX_BASE_PATH} /modules" \
1415 " ${NGINX_BASE_PATH} /sbin" \
Original file line number Diff line number Diff line change 243243 ${addHeaderStrictTransportSecurity}
244244 proxy_pass ${BEACH_ASSET_PROXY_ENDPOINT} /\$ 1\$ is_args\$ args?reqid=\$ request_id;
245245 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;
246250 }
247251EOM
248252 elif [ -n " ${BEACH_GOOGLE_CLOUD_STORAGE_PUBLIC_BUCKET} " ]; then
260264 ${addHeaderStrictTransportSecurity}
261265 proxy_pass https://storage.googleapis.com/${BEACH_GOOGLE_CLOUD_STORAGE_PUBLIC_BUCKET} /\$ 1\$ is_args\$ args?reqid=\$ request_id;
262266 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;
263271 }
264272EOM
265273 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}"
3030export NGINX_ACCESS_LOG_FORMAT="${NGINX_ACCESS_LOG_FORMAT:-default}"
3131export NGINX_ACCESS_LOG_IGNORED_STATUS_CODES_REGEX="${NGINX_ACCESS_LOG_IGNORED_STATUS_CODES_REGEX:-^[13]}"
3232
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 }"
3434export NGINX_CACHE_ENABLE="${NGINX_CACHE_ENABLE:-no}"
3535export NGINX_CACHE_NAME="${NGINX_CACHE_NAME:-application}"
3636export NGINX_CACHE_DEFAULT_LIFETIME="${NGINX_CACHE_DEFAULT_LIFETIME:-5s}"
@@ -39,6 +39,8 @@ export NGINX_CACHE_INACTIVE="${NGINX_CACHE_INACTIVE:-1h}"
3939export NGINX_CACHE_USE_STALE_OPTIONS="${NGINX_CACHE_USE_STALE_OPTIONS:-updating error timeout invalid_header}"
4040export NGINX_CACHE_BACKGROUND_UPDATE="${NGINX_CACHE_BACKGROUND_UPDATE:-off}"
4141
42+ export NGINX_CACHE_RESOURCES_PATH="${NGINX_CACHE_PATH:-${NGINX_BASE_PATH}/cache/resources}"
43+
4244export NGINX_CUSTOM_ERROR_PAGE_CODES="${NGINX_CUSTOM_ERROR_PAGE_CODES:-500 501 502 503}"
4345export NGINX_CUSTOM_ERROR_PAGE_TARGET="${NGINX_CUSTOM_ERROR_PAGE_TARGET:-}"
4446
Original file line number Diff line number Diff line change 1919 scgi_temp_path "${NGINX_TMP_PATH}/scgi" 1 2;
2020 uwsgi_temp_path "${NGINX_TMP_PATH}/uwsgi" 1 2;
2121 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;
2223
2324 include ${NGINX_CONF_PATH}/mime.types;
2425 default_type application/octet-stream;
You can’t perform that action at this time.
0 commit comments