Сервер: Сжимаем страницы и ускоряем сайт на сервере Apache

Сжимаем страницы и ускоряем сайт на сервере Apache

 

// проверить в /etc/httpd/conf/httpd.conf что раскомментирована строка
// LoadModule deflate_module modules/mod_deflate.so
// В конфиг виртуальных хостов /etc/httpd/conf/vhosts.conf добавить:


	 AddOutputFilterByType DEFLATE text/plain
	 AddOutputFilterByType DEFLATE text/html
	 AddOutputFilterByType DEFLATE text/xml
	 AddOutputFilterByType DEFLATE text/css
	 AddOutputFilterByType DEFLATE text/javascript
	 AddOutputFilterByType DEFLATE image/svg+xml
	 AddOutputFilterByType DEFLATE image/x-icon
	 AddOutputFilterByType DEFLATE application/xml
	 AddOutputFilterByType DEFLATE application/xhtml+xml
	 AddOutputFilterByType DEFLATE application/rss+xml
	 AddOutputFilterByType DEFLATE application/javascript
	 AddOutputFilterByType DEFLATE application/x-javascript
	 
	 # Уровень сжатия (9 - максимальный)
	 DeflateCompressionLevel 9
	 
	 BrowserMatch ^Mozilla/4 gzip-only-text/html
	 BrowserMatch ^Mozilla/4\.0[678] no-gzip
	 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
	 BrowserMatch \bOpera !no-gzip 

	 DeflateFilterNote Input instream
	 DeflateFilterNote Output outstream
	 DeflateFilterNote Ratio ratio
	 
	 LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
	 CustomLog logs/deflate_log DEFLATE


// проверить в /etc/httpd/conf/httpd.conf что раскомментирована строка
// LoadModule expire_module modules/mod_expire.so
// В конфиг виртуальных хостов /etc/httpd/conf/vhosts.conf добавить:


	 ExpiresActive On
	 ExpiresByType image/jpg "access plus 60 days"
	 ExpiresByType image/png "access plus 60 days"
	 ExpiresByType image/gif "access plus 60 days"
	 ExpiresByType image/jpeg "access plus 60 days"
	 ExpiresByType text/css "access plus 1 days"
	 ExpiresByType image/x-icon "access plus 1 month"
	 ExpiresByType application/pdf "access plus 1 month"
	 ExpiresByType audio/x-wav "access plus 1 month"
	 ExpiresByType audio/mpeg "access plus 1 month"
	 ExpiresByType video/mpeg "access plus 1 month"
	 ExpiresByType video/mp4 "access plus 1 month"
	 ExpiresByType video/quicktime "access plus 1 month"
	 ExpiresByType video/x-ms-wmv "access plus 1 month"
	 ExpiresByType application/x-shockwave-flash "access 1 month"
	 ExpiresByType text/javascript "access plus 1 week"
	 ExpiresByType application/x-javascript "access plus 1 week"
	 ExpiresByType application/javascript "access plus 1 week"


 
Сервер up: 2.2 г. просмотров: 1.2k