Move FS root to variable in Apache config

This commit is contained in:
Alex Cabal 2022-03-18 11:00:58 -04:00
parent 150b98b698
commit 1e28b9a6aa
2 changed files with 11 additions and 7 deletions

View file

@ -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
<VirtualHost *:80>
ServerName ${domain}
@ -57,12 +59,12 @@ Define domain standardebooks.org
<VirtualHost *:443>
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';"
<Directory /standardebooks.org/web/www/>
<Directory ${webroot}/www/>
# Disable .htaccess files
AllowOverride none

View file

@ -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
<VirtualHost *:80>
ServerName ${domain}
@ -57,19 +59,19 @@ Define domain standardebooks.test
<VirtualHost *:443>
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';"
<Directory /standardebooks.org/web/www/>
<Directory ${webroot}/www/>
# Disable .htaccess files
AllowOverride none