Commit 73b59b53 authored by John Long's avatar John Long

Add support for relying on upstream for cache

Ticket: N/A
parent 8d3f2e52
Pipeline #75536305 passed with stages
in 40 minutes and 50 seconds
......@@ -13,6 +13,21 @@ check_crawlable() {
sed -i "s#{{CRAWL}}#${CRAWL}#g" "$DEST"
}
check_cacheable() {
CACHE_VAR="${HOST[0]}_CACHE"
CACHE="${!CACHE_VAR}"
if [ "${CACHE}" = "upstream" ]; then
CACHE=upstream
elif [ "${CACHE}" = "max" ]; then
CACHE=max
else
CACHE=none
fi
sed -i "s#{{CACHE}}#${CACHE}#g" "$DEST"
}
http_serve() {
VHOST_SRC="/opt/virtual-hosts/http.serve.conf"
VHOST_DEST="/etc/nginx/conf.d/${HOST[1]}.http.conf"
......
......@@ -21,6 +21,7 @@ for HOST in $HOSTS; do
sed -i "s#{{VHOST}}#${HOST[1]}#" "$DEST"
check_crawlable
check_cacheable
"host_${HOST[2]}"
......
expires -1;
add_header Pragma public;
add_header Cache-Control "public,must-revalidate,proxy-revalidate";
expires -1;
add_header Pragma no-cache;
add_header Cache-Control "private,max-age=0";
......@@ -3,7 +3,7 @@ index index.php index.html index.htm;
{{AUTH}}
include /opt/snippets/max_cache.conf;
include /opt/snippets/cache_max.conf;
include /opt/snippets/index_redirect.conf;
include /opt/snippets/deny_apache.conf;
include /opt/snippets/enable_gzip.conf;
......@@ -16,7 +16,7 @@ include /opt/snippets/crawl_{{CRAWL}}.conf;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
include /opt/snippets/no_cache.conf;
include /opt/snippets/cache_{{CACHE}}.conf;
if (!-f $document_root$fastcgi_script_name) {
return 404;
......
......@@ -3,7 +3,7 @@ index index.php index.html index.htm;
{{AUTH}}
include /opt/snippets/max_cache.conf;
include /opt/snippets/cache_max.conf;
include /opt/snippets/index_redirect.conf;
include /opt/snippets/deny_apache.conf;
include /opt/snippets/enable_gzip.conf;
......@@ -16,7 +16,7 @@ include /opt/snippets/crawl_{{CRAWL}}.conf;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
include /opt/snippets/no_cache.conf;
include /opt/snippets/cache_{{CACHE}}.conf;
set $emulated_host $host;
......
......@@ -3,7 +3,7 @@ index index.html index.htm;
{{AUTH}}
include /opt/snippets/max_cache.conf;
include /opt/snippets/cache_max.conf;
include /opt/snippets/index_redirect.conf;
include /opt/snippets/deny_apache.conf;
include /opt/snippets/enable_gzip.conf;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment