首頁 » 網站管理員 » 設計 » 改善您的網站速度
formats

改善您的網站速度

下面是一個列表的事情可以做,以幫助改善您的網站加載速度.

  • 使用gzip壓縮的CSS, 使用Javascript等. 檢查您的網站 在這裡.
  • 最小化您的JavaScript. 您可以使用 JMin 這.
  • 刪除 ETag的
  • 集標頭過期未來
  • 把腳本在頁面底部

GZip壓縮可控制在Apache服務器使用。htaccess的 -



SetOutputFilter DEFLATE

php_flag zlib.output_compression On
php_value zlib.output_compression_level 5

您還可以刪除 ETag的 並設置 頭過期 的. htaccess的使用以下 -



ExpiresActive On
ExpiresDefault "access plus 12 hours"
ExpiresByType image/gif "access plus 2 month"
ExpiresByType image/png "access plus 2 month"
ExpiresByType image/jpeg "access plus 2 month"
ExpiresByType image/ico A2592000
ExpiresByType text/javascript "access plus 2 month"
ExpiresByType text/css "access plus 2 month"
FileETag none

如何在CentOS啟用 GZip壓縮 5

1 . 登錄到SSH,並在以下位置創建一個文件
/etc/httpd/conf.d/deflate.conf

2. Insert the following into the file you just created and save it
# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch bMSIE !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary

# Don't compress already compressed stuff !
SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .pdf$ no-gzip dont-vary

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

# Log Stuff !
# DeflateFilterNote Input input_info
# DeflateFilterNote Output output_info
# DeflateFilterNote Ratio ratio_info
# LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate
# CustomLog /var/log/httpd/deflate_log deflate

3. 重新啟動 Apache和你完成
/etc/init.d/httpd restart

 

留下!

您的電子郵件地址不會被公開. 必填字段標記為 *

*

您可以使用這些 的HTML 標籤和屬性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© ServA1
credit