From 1e28b9a6aa7bfb860ded179341e8a43d7bafd7d6 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Fri, 18 Mar 2022 11:00:58 -0400 Subject: [PATCH] Move FS root to variable in Apache config --- config/apache/standardebooks.org.conf | 8 +++++--- config/apache/standardebooks.test.conf | 10 ++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/config/apache/standardebooks.org.conf b/config/apache/standardebooks.org.conf index 87eca2ee..6e6456aa 100644 --- a/config/apache/standardebooks.org.conf +++ b/config/apache/standardebooks.org.conf @@ -30,6 +30,7 @@ ExpiresByType text/css "access plus 6 months" # These lines are a workaround for an Apache bug that prevents mod_deflate, etags, and ExpiresByType working at the same time. # This is probably still broken in 18.04. See https://stackoverflow.com/questions/896974/apache-is-not-sending-304-response-if-mod-deflate-and-addoutputfilterbytype-is +# Can possibly be fixed in Ubuntu 22.04 using https://httpd.apache.org/docs/trunk/mod/mod_deflate.html#deflatealteretag FileETag All RequestHeader edit "If-None-Match" "^\"(.*)-gzip\"$" "\"$1\"" Header edit "ETag" "^\"(.*[^g][^z][^i][^p])\"$" "\"$1-gzip\"" @@ -47,6 +48,7 @@ SSLStaplingResponderTimeout 5 SSLStaplingReturnResponderErrors off Define domain standardebooks.org +Define webroot /standardebooks.org/web ServerName ${domain} @@ -57,12 +59,12 @@ Define domain standardebooks.org ServerName ${domain} ServerAlias www.${domain} - DocumentRoot /standardebooks.org/web/www + DocumentRoot ${webroot}/www ErrorDocument 404 /404 ErrorLog /var/log/local/www-error.log DirectorySlash Off RewriteEngine on - CustomLog "|/usr/bin/rotatelogs -f -p /standardebooks.org/web/scripts/rotate-www-logs /var/log/local/apache/www-access.log 86400" combined + CustomLog "|/usr/bin/rotatelogs -f -p ${webroot}/scripts/rotate-www-logs /var/log/local/apache/www-access.log 86400" combined SSLEngine on SSLCertificateFile /etc/letsencrypt/live/${domain}/fullchain.pem @@ -70,7 +72,7 @@ Define domain standardebooks.org Header always set Strict-Transport-Security "max-age=15768000" Header set Content-Security-Policy "default-src 'self';" - + # Disable .htaccess files AllowOverride none diff --git a/config/apache/standardebooks.test.conf b/config/apache/standardebooks.test.conf index 6bcbcf86..5b98c1b9 100644 --- a/config/apache/standardebooks.test.conf +++ b/config/apache/standardebooks.test.conf @@ -30,6 +30,7 @@ ExpiresByType text/css "access plus 6 months" # These lines are a workaround for an Apache bug that prevents mod_deflate, etags, and ExpiresByType working at the same time. # This is probably still broken in 18.04. See https://stackoverflow.com/questions/896974/apache-is-not-sending-304-response-if-mod-deflate-and-addoutputfilterbytype-is +# Can possibly be fixed in Ubuntu 22.04 using https://httpd.apache.org/docs/trunk/mod/mod_deflate.html#deflatealteretag FileETag All RequestHeader edit "If-None-Match" "^\"(.*)-gzip\"$" "\"$1\"" Header edit "ETag" "^\"(.*[^g][^z][^i][^p])\"$" "\"$1-gzip\"" @@ -47,6 +48,7 @@ SSLStaplingResponderTimeout 5 SSLStaplingReturnResponderErrors off Define domain standardebooks.test +Define webroot /standardebooks.org/web ServerName ${domain} @@ -57,19 +59,19 @@ Define domain standardebooks.test ServerName ${domain} ServerAlias www.${domain} - DocumentRoot /standardebooks.org/web/www + DocumentRoot ${webroot}/www ErrorDocument 404 /404 ErrorLog /var/log/local/www-error.log DirectorySlash Off RewriteEngine on SSLEngine on - SSLCertificateFile /standardebooks.org/web/config/ssl/${domain}.crt - SSLCertificateKeyFile /standardebooks.org/web/config/ssl/${domain}.key + SSLCertificateFile ${webroot}/config/ssl/${domain}.crt + SSLCertificateKeyFile ${webroot}/config/ssl/${domain}.key Header always set Strict-Transport-Security "max-age=15768000" Header set Content-Security-Policy "default-src 'self';" - + # Disable .htaccess files AllowOverride none