如何在heroku上的PHP应用程序中启用压缩?
发布时间:2020-05-31 00:55:42 所属栏目:PHP 来源:互联网
导读:我在heroku应用程序的.htaccess文件中运行 HTML5 Boilerplate压缩.但是,它似乎没有工作,并且没有文件实际上被压缩. 我添加了heroku php buildpack: heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php 但那似乎没有做任何事情
|
我在heroku应用程序的.htaccess文件中运行 HTML5 Boilerplate压缩.但是,它似乎没有工作,并且没有文件实际上被压缩. 我添加了heroku php buildpack: heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php 但那似乎没有做任何事情.我对Heroku很新,所以有人有什么建议吗? HTML5 Boilerplate 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>
我发现使用不同的buildpack工作了!
heroku config:set BUILDPACK_URL=http://github.com/iphoting/heroku-buildpack-php-tyler 这是一个很棒的buildpack,支持gzip压缩并安装新文件. (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
