Php Nginx和gzip不工作。我错在哪里

Php Nginx和gzip不工作。我错在哪里,php,nginx,Php,Nginx,我使用nginx和phpfpm,但无法让gzip压缩任何内容。服务器是Centos 6.5,带有编译的nginx,命令:--sbin path=/usr/sbin/nginx--with-http\u stub\u status\u module--conf path=/etc/nginx/nginx.conf--pid path=/var/run/nginx.pid--error log path=/var/log/nginx/access.log--user=nginx--with-http

我使用nginx和phpfpm,但无法让gzip压缩任何内容。服务器是Centos 6.5,带有编译的nginx,命令:--sbin path=/usr/sbin/nginx--with-http\u stub\u status\u module--conf path=/etc/nginx/nginx.conf--pid path=/var/run/nginx.pid--error log path=/var/log/nginx/access.log--user=nginx--with-http\u gzip\u static\u module

以下是nginx.conf:

    include       /etc/nginx/mime.types;
default_type  application/octet-stream;
access_log off;
log_not_found off;
sendfile        on;
tcp_nopush     on;
tcp_nodelay on;
client_body_timeout   30;
client_header_timeout 30;
keepalive_timeout     45;
send_timeout          30;
reset_timedout_connection on;
output_buffers 1 8M;
gzip              on;
gzip_static       on;
gzip_buffers      16 8k;
gzip_comp_level   5;
gzip_http_version 1.1;
gzip_min_length   2;
gzip_types        text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss;
gzip_vary         on;
gzip_proxied any;
#gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_disable msie6;
server_names_hash_max_size 1024;
server_names_hash_bucket_size 128;
open_file_cache max=20000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
client_body_buffer_size 1024k;
fastcgi_buffers 64 64k;
include /etc/nginx/conf.d/domains/*.conf;
下面是domain.conf:

    server {
    listen xx.xx.xx.xx:80;
    server_name xxxxxxxx.com;
    if ( $host ~* ^(?!(www|cdn)\.) ) {
       rewrite .* $scheme://www.$host$request_uri permanent;
    }
    index index.php;
    charset utf-8;.
    if ($request_uri ~* "^(.*(?<!expert)/)index\.php$") {
        return 301 $1;
    }
    root /home/ftpaccess/xxxxxxx/www;
    location ~* ^.+\.(txt|js|css|doc|xls|pdf|ppt|rtf|jpg|jpeg|gif|bmp|ico|zip|tgz|gz|bz2|exe|tar|wav|avi|flv|mpg|mpeg|mp4|mp3|png)$ {
        expires 720h;
        add_header Pragma public;
        add_header Cache-Control "public";
    }
    location ~ /\.ht {
        deny all;
    }
    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt { access_log off; log_not_found off; allow all;}
    location = /apple-touch-icon.png { access_log off; log_not_found off; }
    location = /apple-touch-icon-precomposed.png { access_log off; log_not_found off; }
    error_page 404 /404.php;
    include /etc/nginx/conf.d/redirect/xxxxxx.conf;
    location ~ \.php$ {
        include /etc/nginx/php.conf;
        include        /etc/nginx/fastcgi_params;
    }
}
curl-I-H“接受编码:gzip,deflate”响应:

HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Mon, 03 Nov 2014 22:14:23 GMT
Content-Type: text/html; charset: iso-8859-1
Connection: keep-alive
Set-Cookie: PHPSESSID=0pi4o2i83gvof758gep5nc01m5; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Mon, 03 Nov 2014 22:15:21 GMT
Content-Type: application/javascript
Content-Length: 5241
Last-Modified: Mon, 03 Nov 2014 21:21:28 GMT
Connection: keep-alive
Expires: Wed, 03 Dec 2014 22:15:21 GMT
Cache-Control: max-age=2592000
Pragma: public
Cache-Control: public
Accept-Ranges: bytes
curl-I-H“接受编码:gzip,deflate”响应:

HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Mon, 03 Nov 2014 22:14:23 GMT
Content-Type: text/html; charset: iso-8859-1
Connection: keep-alive
Set-Cookie: PHPSESSID=0pi4o2i83gvof758gep5nc01m5; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Mon, 03 Nov 2014 22:15:21 GMT
Content-Type: application/javascript
Content-Length: 5241
Last-Modified: Mon, 03 Nov 2014 21:21:28 GMT
Connection: keep-alive
Expires: Wed, 03 Dec 2014 22:15:21 GMT
Cache-Control: max-age=2592000
Pragma: public
Cache-Control: public
Accept-Ranges: bytes

我哪里做错了,如何纠正?几乎什么都试过了,但都没有成功。

您的
gzip\u类型
不包括您所指的类型

如您所见,您的配置包括以下类型:
text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss
但您同时引用了
text/javascript
application/javascript