97国产永久网址在线观看_日韩成人一区二区三区在线观看_高清无码一区二区三区在线_日本强在线播放一区

首先在httpd.conf里面,開啟緩存的相關模塊。

Apache httpd 2.4 反向代理 開啟緩存

然后配置如下幾個參數即可

Apache httpd 2.4 反向代理 開啟緩存
CacheRoot "xxx"
CacheEnable disk xxx
CacheDirLevels 5
CacheDirLength 4
CacheMinFileSize 10
CacheMaxFileSize 4000000

其中CacheRoot要確保Apache運行的用戶有權限。可以寫多個 CacheEnable disk xxx來自定義緩存配置。

部分參數意義如下:

CacheRoot 指令

描述:存儲緩存 files 的目錄根目錄
句法:CacheRoot directory
Context:server config,virtual host
狀態:延期
模塊:mod_cache_disk

CacheRoot指令定義磁盤上包含 cache files 的目錄的 name。如果已將mod_cache_disk模塊加載或編譯到 Apache 服務器,則必須定義此指令。未能為CacheRoot提供 value 將導致 configuration 文件處理錯誤。 CacheDirLevels和CacheDirLength指令定義指定根目錄下的目錄結構。

CacheDirLevels 指令

描述:緩存中子目錄的級別數。
句法:CacheDirLevels levels
默認:CacheDirLevels 2
Context:server config,virtual host
狀態:延期
模塊:mod_cache_disk

CacheDirLevels指令設置緩存中的子目錄級別數。緩存的數據將保存在CacheRoot目錄下的許多目錄級別。

CacheDirLevels的高值與CacheDirLength的低值相結合將導致相對較深的層次結構,每個 level 都有少量子目錄。

CacheDirLevels?* CacheDirLength的結果不得高于 20。

CacheDirLength 指令

描述:子目錄名稱中的字符數
句法:CacheDirLength length
默認:CacheDirLength 2
Context:server config,virtual host
狀態:延期
模塊:mod_cache_disk

CacheDirLength指令設置緩存層次結構中每個子目錄 name 的字符數。它可以與CacheDirLevels結合使用,以確定緩存層次結構的近似結構。

CacheDirLength的高值與CacheDirLevels的低值相結合將導致相對平坦的層次結構,每個 level 都有大量子目錄。

CacheDirLevels *?CacheDirLength的結果不得高于 20。

另外也可以使用 mod_expires 模塊的Expire/Cache-Control頭來控制,同樣首先需要刪除掉配置文件前面的#,開啟這個模塊。

Apache httpd 2.4 反向代理 開啟緩存

A7200000代表文件緩存7200000/3600/24=83天

<IfModule expires_module>
ExpiresActive on
ExpiresByType text/css A7200000
ExpiresByType text/min.css A7200000
ExpiresByType text/x-component A7200000
ExpiresByType image/jpeg A7200000
ExpiresByType image/gif A7200000
ExpiresByType image/png A7200000
ExpiresByType image/bmp A7200000
ExpiresByType image/x-icon A7200000
ExpiresByType image/svg+xml A7200000
ExpiresByType audio/ogg A7200000
ExpiresByType video/mp4 A7200000
ExpiresByType video/ogg A7200000
ExpiresByType video/webm A7200000
ExpiresByType video/x-flv A7200000
ExpiresByType application/json A7200000
ExpiresByType application/xml A7200000
ExpiresByType application/pdf A7200000
ExpiresByType application/javascript A7200000
ExpiresByType application/x-javascript A7200000
ExpiresByType application/x-font-ttf A7200000
ExpiresByType application/font-woff A7200000
ExpiresByType application/font-woff2 A7200000
ExpiresByType application/x-shockwave-flash A7200000
</IfModule>

<FilesMatch "\.(ico|pdf|flv|mp4|jpg|jpeg|png|gif|js|css|swf)$">
    ExpiresDefault "access plus 1 year"
</FilesMatch>

相關文章

發表回復

您的郵箱地址不會被公開。 必填項已用 * 標注

聯系電話

176-8951-1878

微信
微信
分享本頁
返回頂部
西藏巨騰信息技術有限公司提供拉薩網站建設、軟件開發、小程序開發、APP開發、網絡營銷、在線推廣、在線商城開發等服務,聯系電話: 17689511878
主站蜘蛛池模板: 郓城县| 绥滨县| 广汉市| 漳平市| 稻城县| 镇远县| 嘉善县| 西乌珠穆沁旗| 兰州市| 合作市| 黑龙江省| 新建县| 临泉县| 永定县| 阳西县| 定边县| 娄底市| 屏山县| 宝清县| 邻水| 定西市| 潍坊市| 双桥区| 西乌| 军事| 右玉县| 沙洋县| 额尔古纳市| 嘉祥县| 东乌珠穆沁旗| 通化县| 广德县| 手机| 陇南市| 雷波县| 安西县| 改则县| 临武县| 兴安盟| 金阳县| 松潘县|