2013-11-02 51 views
4

我在heroku應用程序的.htaccess文件中運行HTML5 Boilerplate壓縮。然而,它似乎並沒有工作,沒有任何文件實際上被壓縮。如何在heroku上的PHP應用程序中啓用壓縮?

我加入了Heroku的PHP buildpack有:

heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php 

,但似乎並沒有做任何事情。我對Heroku相當陌生,所以有人有任何建議嗎?

HTML5樣板的htaccess代碼:

# Force compression for mangled headers. 
# http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping 
<IfModule mod_setenvif.c> 
    <IfModule mod_headers.c> 
     SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding 
     RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding 
    </IfModule> 
</IfModule> 

# Compress all output labeled with one of the following MIME-types 
# (for Apache versions below 2.3.7, you don't need to enable `mod_filter` 
# and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines 
# as `AddOutputFilterByType` is still in the core directives). 
<IfModule mod_filter.c> 
    AddOutputFilterByType DEFLATE application/atom+xml \ 
            application/javascript \ 
            application/json \ 
            application/rss+xml \ 
            application/vnd.ms-fontobject \ 
            application/x-font-ttf \ 
            application/x-web-app-manifest+json \ 
            application/xhtml+xml \ 
            application/xml \ 
            font/opentype \ 
            image/svg+xml \ 
            image/x-icon \ 
            text/css \ 
            text/html \ 
            text/plain \ 
            text/x-component \ 
            text/xml 
</IfModule> 

+0

他已經嘗試了他的服務器。 – jacouh

回答

2

我發現,使用不同的buildpack工作!

heroku config:set BUILDPACK_URL=http://github.com/iphoting/heroku-buildpack-php-tyler 

這是一個很棒的buildpack,可以實現gzip壓縮並安裝新的文物。

+0

對我來說它顯示一個錯誤:「stdin:不是gzip格式」。我應該在heroku上安裝一些插件嗎? – rodrigorf

+0

我得到了同樣的錯誤@rodrigorf –

+0

仍然收到相同的錯誤@EzraObiwale,迄今爲止沒有解決方案。 – rodrigorf

相關問題