client caching
This commit is contained in:
parent
c2b05c463c
commit
4dea1975e2
|
@ -0,0 +1,4 @@
|
|||
location ~* \.(%CLIENT_CACHE_EXTENSIONS%)$ {
|
||||
etag %CLIENT_CACHE_ETAG%;
|
||||
add_header Cache-Control "%CLIENT_CACHE_CONTROL%";
|
||||
}
|
|
@ -31,4 +31,5 @@ server {
|
|||
%COOKIE_FLAGS%
|
||||
%ERRORS%
|
||||
%USE_FAIL2BAN%
|
||||
%USE_CLIENT_CACHE%
|
||||
}
|
||||
|
|
|
@ -4,13 +4,14 @@ HTTP_PORT="${HTTP_PORT-8080}"
|
|||
HTTPS_PORT="${HTTPS_PORT-8443}"
|
||||
MAX_CLIENT_SIZE="${MAX_CLIENT_SIZE-10m}"
|
||||
SERVER_TOKENS="${SERVER_TOKENS-off}"
|
||||
USE_CLIENT_CACHE="${USE_CLIENT_CACHE-yes}"
|
||||
CLIENT_CACHE_EXTENSIONS="${CLIENT_CACHE_EXTENSIONS-jpg|jpeg|png|bmp|ico|svg|tif|css|js|otf|ttf|eot|woff|woff2}"
|
||||
CLIENT_CACHE_CONTROL="${CLIENT_CACHE_CONTROL-public, max-age=15552000}"
|
||||
CLIENT_CACHE_ETAG="${CLIENT_CACHE_ETAG-on}"
|
||||
CACHE="${CACHE-max=1000 inactive=60s}"
|
||||
CACHE_ERRORS="${CACHE_ERRORS-on}"
|
||||
CACHE_USES="${CACHE_USES-1}"
|
||||
CACHE_VALID="${CACHE_VALID-60s}"
|
||||
#CLIENT_CACHE="${CLIENT_CACHE}-css|gif|htm|html|ico|jpeg|jpg|js|png|svg|tif|tiff|eot|otf|ttf|woff|woff2"
|
||||
#CLIENT_CACHE_EXPIRES="${CLIENT_CACHE_EXPIRES}-1d}"
|
||||
#CLIENT_CACHE_CONTROL=
|
||||
USE_GZIP="${USE_GZIP-off}"
|
||||
GZIP_COMP_LEVEL="${GZIP_COMP_LEVEL-6}"
|
||||
GZIP_MIN_LENGTH="${GZIP_MIN_LENGTH-10240}"
|
||||
|
|
|
@ -36,6 +36,17 @@ else
|
|||
replace_in_file "${NGINX_PREFIX}server.conf" "%SERVER_CONF%" "include /server-confs/*.conf;"
|
||||
fi
|
||||
|
||||
# client caching
|
||||
if [ "$USE_CLIENT_CACHE" = "yes" ] ;
|
||||
replace_in_file "${NGINX_PREFIX}server.conf" "%USE_CLIENT_CACHE%" "include ${NGINX_PREFIX}client-cache.conf;"
|
||||
replace_in_file "${NGINX_PREFIX}client-cache.conf" "%CLIENT_CACHE_EXTENSIONS%" "$CLIENT_CACHE_EXTENSIONS"
|
||||
replace_in_file "${NGINX_PREFIX}client-cache.conf" "%CLIENT_CACHE_ETAG%" "$CLIENT_CACHE_ETAG"
|
||||
replace_in_file "${NGINX_PREFIX}client-cache.conf" "%CLIENT_CACHE_CONTROL%" "$CLIENT_CACHE_CONTROL"
|
||||
|
||||
else
|
||||
replace_in_file "${NGINX_PREFIX}server.conf" "%USE_CLIENT_CACHE%" ""
|
||||
fi
|
||||
|
||||
# remote PHP
|
||||
if [ "$REMOTE_PHP" != "" ] ; then
|
||||
replace_in_file "${NGINX_PREFIX}server.conf" "%USE_PHP%" "include ${NGINX_PREFIX}php.conf;"
|
||||
|
|
Loading…
Reference in New Issue