Brotli設定
インターネット通信を新しい圧縮アルゴリズム「Brotli」にて圧縮する
プラグイン読み込み
/etc/httpd/conf.modules.d/00-brotli.conf
LoadModule brotli_module modules/mod_brotli.so
バーチャルホスト設定
/etc/httpd/conf.d/virtualhost.example.com.conf
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/example.com
ErrorLog logs/example.com/error_log
CustomLog logs/example.com/access_log combined env=!nolog
</VirtualHost>
<VirtualHost *:443>
ServerName example.com
DocumentRoot /var/www/example.com
ErrorLog logs/example.com/ssl_error_log
CustomLog logs/example.com/ssl_access_log combined env=!nolog
Protocols h2 http/1.1
# Brotli settings
SetOutputFilter BROTLI_COMPRESS
SetEnvIfNoCase Requst_URI \.(bmp|gif|htc|ico|jpe?g|mpe?g|png|swf|woff|ttf)$" no-brotli
BrotliCompressionQuality 5
BrotliCompressionWindow 18
BrotliFilterNote Input instream
BrotliFilterNote Output outstream
BrotliFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' brotli
CustomLog "logs/example.com/brotli_log" brotli
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
Header always set Strict-Transport-Security "max-age=31536000"
</VirtualHost>
Apache再起動
systemctl restart httpd