diff --git a/Dockerfile b/Dockerfile
index 161f1a4..9121c78 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -29,6 +29,11 @@ RUN chmod u+x /entrypoint.sh
COPY files/000-default.conf /etc/apache2/sites-enabled/000-default.conf
+# Add caching and compression config to .htaccess
+COPY files/001-htaccess.conf .
+RUN cat /001-htaccess.conf >> /var/www/spotweb/.htaccess
+RUN rm /001-htaccess.conf
+
VOLUME [ "/config" ]
EXPOSE 80
diff --git a/entrypoint.sh b/entrypoint.sh
index 57ecfec..2a652fb 100644
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -54,7 +54,15 @@ fi
# Clean up apache pid (if there is one)
rm -rf /run/apache2/apache2.pid
-# Enabling PHP mod rewrite
-/usr/sbin/a2enmod rewrite && /etc/init.d/apache2 restart
+# Enabling PHP mod rewrite, expires and deflate (they may be on already by default)
+unset rt
+/usr/sbin/a2enmod rewrite && rt=1
+/usr/sbin/a2enmod expires && rt=1
+/usr/sbin/a2enmod deflate && rt=1
+
+# Only restart if one of the enmod commands succeeded
+if [[ -n $rt ]]; then
+ /etc/init.d/apache2 restart
+fi
tail -F /var/log/apache2/* /dev/stdout /dev/stderr
diff --git a/files/001-htaccess.conf b/files/001-htaccess.conf
new file mode 100644
index 0000000..7cbc322
--- /dev/null
+++ b/files/001-htaccess.conf
@@ -0,0 +1,32 @@
+
+ ExpiresActive On
+ ExpiresDefault "access plus 4 hours"
+ ExpiresByType application/javascript A900
+ ExpiresByType application/x-javascript A900
+ ExpiresByType text/javascript A900
+ ExpiresByType text/html A90
+ ExpiresByType text/xml A90
+ ExpiresByType text/css A900
+ ExpiresByType text/plain A62
+ ExpiresByType image/gif A14400
+ ExpiresByType image/jpg A14400
+ ExpiresByType image/jpeg A14400
+ ExpiresByType image/png A14400
+ ExpiresByType image/bmp A14400
+ ExpiresByType application/x-shockwave-flash A3600
+
+
+ AddOutputFilterByType DEFLATE text/plain
+ AddOutputFilterByType DEFLATE text/html
+ AddOutputFilterByType DEFLATE text/xml
+ AddOutputFilterByType DEFLATE text/css
+ AddOutputFilterByType DEFLATE application/xml
+ AddOutputFilterByType DEFLATE application/xhtml+xml
+ AddOutputFilterByType DEFLATE application/rss+xml
+ AddOutputFilterByType DEFLATE application/javascript
+ AddOutputFilterByType DEFLATE application/x-javascript
+
+ BrowserMatch ^Mozilla/4 gzip-only-text/html
+ BrowserMatch ^Mozilla/4\.0[678] no-gzip
+ BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
+
\ No newline at end of file