<b>Stop compressing the same file on every request</b>
nginx gzip is fine, but it re-compresses your CSS on every single hit, burning CPU you don't have on a cheap box. Pre-compress static assets ONCE at deploy time:
— <code>find dist -name '*.css' -o -name '*.js' | xargs gzip -9 -k</code>
— enable <code>gzip_static on;</code> in nginx
Now nginx serves the <code>.gz</code> file straight off disk, zero CPU per request. Add brotli precompression too if your build supports it. CPU dropped, and the bytes on the wire are smaller because you used <code>-9</code>. Try it tonight.
Root Access Daily
@RootAccessDaily
<b>Stop compressing the same file on every request</b>
Этот пост опубликован в Telegram-канале Root Access Daily. Подписаться можно по ссылке: @RootAccessDaily.