網頁前端優化 apache篇

2021-08-25 18:48:16 字數 695 閱讀 4155

以下配置內容放在 httpd.conf 配置檔案最後即可,全域性有效.

1.設定靜態檔案的有效期

expiresactive on

expiresdefault "access plus 10 years"

參考:[url]

2.啟用gzip壓縮

deflatebuffersize 8096

deflatecompressionlevel 1

deflatememlevel 9

deflatewindowsize 15

deflatefilternote input instream

deflatefilternote output outstream

deflatefilternote ratio ratio

deflatefilternote ratio

logformat '"%r" %n/%n (%n%%)' deflate

customlog logs/deflate.log deflate

setoutputfilter deflate

參考:[url]注意上面的日誌路徑要正確

3.配置etags減少web應用頻寬和負載

fileetag none

參考:[url]

4.使用不同的網域名稱提高網頁效率-優化**效能(yslow)

參考:[url]

Apache網頁優化 網頁快取

apache 的mod expries 模組會自動生成頁面頭部資訊中的 express標籤和 cache control 標籤。客戶端瀏覽器根據標籤決定下次訪問是在本地機器的快取中獲取頁面,不需要再次向伺服器發出請求,從而降低客戶端的訪問頻率和次數,達到減少不必要的流量和增加訪問速度的目的。1 先關...

前端網頁優化方案

合併 壓縮 混淆html css js檔案 webpack實現,減小資源大小 nginx開啟gzip,進一步壓縮資源 減小資源大小 資源使用cdn加速 提高載入速度 符合條件的圖示做base64處理 減小資源大小 樣式表放首部,js放尾部 js單執行緒,會阻塞頁面 資源載入方式 設定快取 強快取和協...

Apache 網頁與安全優化

優化內容 gzip 介紹 servertokens 輸出格式 選項 輸出格式 prod server apache major server apache 2 minor server apache 2.0 os server apache 2.0.41 unix full server apach...