启用数据COM pression为的Apache2 + FastCGI的设置 [英] Enabling data compression for Apache2 + FastCGI setup

查看:176
本文介绍了启用数据COM pression为的Apache2 + FastCGI的设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题被有关我在这里早期的岗位:
CSS加载问题与Android ICS

This Question is Related to my earlier post here: CSS loading issue with Android ICS.

在哪里我面临的问题是 CSS和JS渲染由Android ICS的默认和海豚浏览器即可。此内容是从我的服务器的后端引擎,它使用(的Apache2 + FastCGI的Python的+ )安装服务。

Where I was facing issue with CSS and JS rendering by Android ICS's default and Dolphin browser. This content is served from my Server's Backend Engine, Which uses (Apache2 + FastCGI + Python) setup.

当搜寻可能存在的问题,我发现,问题的主要原因是,内容并不从服务器COM pressed形式发送的。

While searching for possible problems, I found that main cause for problem was, content was NOT sent in compressed form from Server.

所以样品的响应头的看起来如下:

So sample Response Header looks something as follows:

Connection  Keep-Alive
Content-Encoding    gzip
Content-Length  5997
Content-Type    text/css
Date    Sun, 29 Jul 2012 14:29:08 GMT
Keep-Alive  timeout=15, max=100
Server  Apache (Ubuntu)
Vary    Accept-Encoding

和同样如果内容是从平面文件服务。响应头看起来如下的东西。这是由所有的浏览器正确地呈现。

and If Same content is served from flat file. Response header looks something as below. Which is rendered properly by all Browsers.

Accept-Ranges   bytes
Connection  Keep-Alive
Content-Encoding    gzip
Content-Length  1430
Content-Type    text/css
Date    Sun, 29 Jul 2012 14:28:57 GMT
Etag    "a9c06-176d-4c5e693c2a6c0"
Keep-Alive  timeout=15, max=100
Last-Modified   Sat, 28 Jul 2012 16:46:59 GMT
Server  Apache (Ubuntu)
Vary    Accept-Encoding

和一些如何,Android的ICS的默认和海豚浏览器无法呈现的内容(特别是CSS,JS内容)。它的工作原理与所有其他浏览器。

and Some How, Android ICS's default and dolphin Browser are not able to render the content (Specially css, js content). It works with all other Browsers.

但本质上,没有与后端引擎的一些问题,还因为它的uncom pressed发送数据。这里看起来有一些有趣的点,在响应头:

But Essentially, there is some problem with Backend engine also because of which uncompressed data is sent. There are few Interesting points here to look, in Response header:


  1. 响应头包含字段,指出内容编码gzip的

  2. 但是内容长度显示Uncom $ P $的长度pssed资源的版本。

要解决我想这个问题的一些小的改动建筑学的,在我认为可能是一个问题原因的地方。
我注意到,按CGI更换FastCGI的解决我的问题并数据现在打开Com pressed格式发送。

To solve the problem I tried few small changes in Architecture, in places where I thought could be a problem cause. I noticed, replacing the fastCGI by CGI solved my Problem and data is sent in Compressed Format now.

虽然问题解决,但我绝对的要使用的FastCGI 的。所以我寻找可以解决问题的可能的配置更改。
我已经在服务器的Apache的设置做了如下安排:

Though the problem is solved but I definately want to use fastCGI. So I am looking for possible configuration changes that can solve Problem. I have done following Arrangements in Server's Apache settings:


  1. 启用紧缩从可用的Apache模块模块

  2. 我的 /etc/apache2/mods-enabled/deflate.conf 文件有以下文字:

<IfModule mod_deflate.c>
          # these are known to be safe with MSIE 6
          AddOutputFilterByType DEFLATE text/html text/plain text/xml
          # everything else may cause problems with MSIE 6
          AddOutputFilterByType DEFLATE text/css
          AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
          AddOutputFilterByType DEFLATE application/rss+xml
</IfModule>


  • 我有以下行,以使FastCGI的工作,我的脚本在的/ etc / apache2的/启用站点-/默认文件。

    <Files my_script_name.py>
        SetHandler fastcgi-script 
    </Files>
    
    FastCgiServer /path_to_script/my_script_name.py -processes 4 -socket /tmp/my_script_name.sock
    


  • 我试过各种配置的变化,但他们都不似乎解决我的问题。有没有办法,我很想念这里的 FastCGI的启用COM pression

    Question

    I tried various configuration changes But None of them seems to be solving my Problem. Is there any thing that I am missing here to Enable compression with fastCGI?

    在任何帮助,这将是鸭preciated。

    Any help in this will be Appreciated.

    由于提前

    推荐答案

    最后,我能在这里找到问题的解决方案:
    http://wiki.catalystframework.org/wiki/deployment/apache_fastcgi

    Finally, I was able to find the solution of problem here: http://wiki.catalystframework.org/wiki/deployment/apache_fastcgi

    在这里,对于一个问题的答案:?为什么我的应用程序很慢,服务空白页,和/或unexpededly行事FAQ部分后,他们清楚地说

    Here, For answer of a Question: Why is my application so slow, serving blank pages, and/or acting unexpededly? in FAQ section, they clearly say that.

    的mod_fastcgi mod_deflate模块下的某些版本没有很好地共存
      阿帕奇(Debian Lenny的股票套餐为例)。一种解决方法是
      不加载放气模块。另一种解决方案是构建
      和安装的mod_fastcgi的最近的快照版本(适用于发现
       http://www.fastcgi.com/dist/ )。

    mod_fastcgi and mod_deflate do not coexist well under certain versions of apache (Debian Lenny stock packages for example). A workaround is to not load the deflate module. An alternative solution is to build and install a recent snapshot version of mod_fastcgi (found at http://www.fastcgi.com/dist/).

    因此​​,对岗位的建议,我更新的中的libapache2-MOD-的FastCGI 包服务器上,现在我正在逐渐用正确的响应头值的客户端COM pressed数据。

    So as suggested on post, I updated libapache2-mod-fastcgi package on Server and now I am getting compressed data at client side with correct Response header values.

    感谢

    这篇关于启用数据COM pression为的Apache2 + FastCGI的设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆