diff --git a/install_httpd-2.4.sh b/install_httpd-2.4.sh index 5febc63..3d5eccf 100755 --- a/install_httpd-2.4.sh +++ b/install_httpd-2.4.sh @@ -3736,6 +3736,71 @@ else fi +## - Add configuration for custom log format file: 000-deflate.conf +## - +echo "## - Add configuration to enable compression: 000-deflate.conf.." >> ${_logdir}/main.log +echo "## -" >> ${_logdir}/main.log +echo "" +echononl "\tAdd configuration to enable compression: 000-deflate.conf.." +cat << EOF > ${PREFIX}/conf/vhosts/000-deflate.conf +# --- +# - Enable output compression +# --- + + + # Serve gzip compressed CSS and JS files if they exist + # and the client accepts gzip. + RewriteCond "%{HTTP:Accept-encoding}" "gzip" + RewriteCond "%{REQUEST_FILENAME}\.gz" -s + RewriteRule "^(.*)\.(css|js)" "\$1\.\$2\.gz" [QSA] + + + # Serve correct content types, and prevent mod_deflate double gzip. + RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-gzip:1] + RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1] + + + + # Serve correct encoding type. + Header append Content-Encoding gzip + + # Force proxies to cache gzipped & + # non-gzipped css/js files separately. + Header append Vary Accept-Encoding + + + + + + SetOutputFilter DEFLATE + + # You can't compress what is already compressed + SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary + SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary + SetEnvIfNoCase Request_URI .(?:avi|mov|mp3|mp4|rm|flv|swf|mp?g)\$ no-gzip dont-vary + SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary + + + + + + DeflateFilterNote Input instream + DeflateFilterNote Output outstream + DeflateFilterNote Ratio ratio + LogFormat '%v "%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate + + + + +EOF +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + warn "Adding config file 000-deflate.conf failed." +fi + + ## - Add configuration for custom log format file: 000-logformat.conf ## - echo "## - Add configuration for custom log format file: 000-logformat.conf.." >> ${_logdir}/main.log