為Apache添加mod_expire模組

來源:互聯網
上載者:User

標籤:伺服器   動態   

一.檢查是否安裝
1.靜態編譯
    bin/apachectl -l|grep mod_expires
    mod_expires.c
2.動態編譯
    grep mod_expires conf/httpd.conf
    或者 
    ll /application/apache/modules/ |grep expires

3.以DSO的方法補裝
    /application/apache/bin/apxs -c -i -a mod_expires.c
    apxs是一個為apache編譯安裝擴充模組的工具."--with-apxs2=/application/apache/bin/apxs";apxs參數說明:
        -c此選項表示需要執行編譯操作
        -i 此選項表示需要執行安裝操作,安裝一個或多個動態對象到伺服器的Modules目錄中
        -a 此選項自動增加一個LoadModule行到httpd.conf檔案中以激此模組
二.添加配置
 1.添加配置代碼:
    ExpiresActive on
        ExpiresDefault "access plus 12 month"
        ExpiresByType text/html "access plus 12 months"
        ExpiresByType text/css "access plus 12 months"
        ExpiresByType image/gif "access plus 12 months"
        ExpiresByType image/jpeg "access plus 12 months"
        ExpiresByType image/jpg "access plus 12 months"
        ExpiresByType image/png "access plus 12 months"
        EXpiresByType application/x-shockwave-flash "access plus 12 months"
        EXpiresByType application/x-javascript "access plus 12 months"
        ExpiresByType video/x-flv "access plus 12 months"
 2.範圍:
    A.server config, virtual host, directory, .htaccess

    B.爭對具體的目錄在http.conf中設定的緩衝執行個體
        <Directory "/data/www/blog/wp-content/">
            ExpiresByType image/gif "access plus 12 months"
            ExpiresByType image/jpeg "access plus 12 months"
            ExpiresByType image/jpg "access plus 12 months"
            ExpiresByType image/png "access plus 12 months"
        </Directory>

為Apache添加mod_expire模組

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.