From 0bc058aa9e9c1b9eab7f7d75209fe6d774fe1fc3 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Sat, 3 Jun 2023 21:44:13 +0100
Subject: [PATCH] Create cache/.htaccess at startup

In case it's a tmpfs.
---
 docker/conf/cont-init.d/50cache-htaccess | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100755 docker/conf/cont-init.d/50cache-htaccess

diff --git a/docker/conf/cont-init.d/50cache-htaccess b/docker/conf/cont-init.d/50cache-htaccess
new file mode 100755
index 00000000..7d7b6828
--- /dev/null
+++ b/docker/conf/cont-init.d/50cache-htaccess
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+cache_dir=/opt/noblogs/www/wp-content/cache
+
+if [ ! -e "$cache_dir/.htaccess" ]; then
+    mkdir -p $cache_dir
+    cat >"$cache_dir/.htaccess" <<EOF
+Options -Indexes
+Header set Vary "Accept-Encoding, Cookie"
+Header set Cache-Control "max-age=300"
+ExpiresActive On
+ExpiresByType text/html A300
+EOF
+fi
+
+exit 0
-- 
GitLab