Оптимизация трафика с сервера Apache2

Данный раздел справки показывает как можно повысить скорость доставки веб-страничек проекта вашим пользователям.
Для мониторинга нам понадобится Firefox и несколько дополнений к нему(ставить в порядке перечисления), а именно:
"Firebug"
"Page Analysis"
"Live HTTP Headers" для просмотра заголовка

Поехали:
1. Подключаем необходимые модули в Apache

$sudo a2enmod expires
$sudo a2enmod headers
$sudo /etc/init.d/apache2 restart

2. Правим файлик (добавляем в него строчки):

$sudo nano /etc/apache2/sites-available/default

<IfModule mod_deflate.c>
# Insert filter
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4\.0[678] no-gzip
#BrowserMatch \bMSIE no-gzip
BrowserMatch MSIE no-gzip

# file-types indicated will not be compressed
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|bmp|rar|zip|7z|bz?|pdf)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

  <IfModule mod_headers.c>
    Header append Vary User-Agent
  </IfModule>
</IfModule>

<IfModule mod_expires.c>
# enable expirations
ExpiresActive On

ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/jpg "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
ExpiresByType image/bmp "access plus 1 week"
ExpiresByType image/x-icon "access plus 1 week"

ExpiresByType text/css "access plus 1 days"

ExpiresByType application/pdf "access plus 1 days"
ExpiresByType audio/x-wav "access plus 1 week"
ExpiresByType audio/mpeg "access plus 1 week"
ExpiresByType video/mpeg "access plus 1 week"
ExpiresByType video/mp4 "access plus 1 week"
ExpiresByType video/quicktime "access plus 1 week"
ExpiresByType video/x-ms-wmv "access plus 1 week"

ExpiresByType text/javascript "access plus 1 days"
ExpiresByType application/x-javascript "access plus 1 days"
ExpiresByType application/javascript "access plus 1 days"
ExpiresByType text/html "access plus 30 seconds"
</IfModule>

2. Перезапускаем Apache

$sudo /etc/init.d/apache2 restart

3. Запускаем Firefox, кликаем в правом нижнем углу по "жуку" и выбираем пункт "Page speed" и нажимаем кнопку Analyze perfomance

картинка Внимание! Не все браузеры корректно поддерживают данную фичу. Возможны баги.