2016-10-05 2 views
0

GZIP 같은 컨텐츠 인코딩을 보내 않습니다 오프왜 nginx를 항상 내가 gzip을 설정 한

user nginx; 
worker_processes 1; 

error_log /var/log/nginx/error.log warn; 
pid  /var/run/nginx.pid; 


events { 
    worker_connections 1024; 
} 


http { 
    include  /etc/nginx/mime.types; 
    default_type application/octet-stream; 

    log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 
         '$status $body_bytes_sent "$http_referer" ' 
         '"$http_user_agent" "$http_x_forwarded_for"'; 

    access_log /var/log/nginx/access.log main; 

    sendfile  on; 
    #tcp_nopush  on; 

    keepalive_timeout 65; 
    gzip off; 


    include /etc/nginx/conf.d/*.conf; 
} 

서버 설정

서버 { 80 default_server 듣고;

root   /home/www; 

access_log /var/log/nginx/access.log; 
error_log /var/log/nginx/error.log; 

proxy_buffering off; 

location /frontend { 
location ~* \.php$ { 
    try_files /dev/null @directphp; 
} 
} 

location/{ 
    include fastcgi_params; 
    fastcgi_pass x.x.x.x:9000; 
    fastcgi_param SCRIPT_FILENAME $document_root/index.php; 
} 

location @directphp { 
    include fastcgi_params; 
    fastcgi_pass x.x.x.x:9000; 
    fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; 
} 

}

주목은 다른 곳에서는 아직 컨텐츠가 여전히 GZIP로 전송 getiing됩니다

cd /etc/nginx/ 
grep -R gzip . 

./nginx.conf: gzip off; 


service nginx restart 

설정되어 있지?

응답 헤더는

Connection:keep-alive 
Content-Encoding:gzip 
Content-Length:51 
Content-Type:application/json; charset=utf-8 
Date:Wed, 05 Oct 2016 10:00:00 GMT 
Server:nginx/1.6.2 
Vary:Accept-Encoding 

완전히

+0

표시 서버 설정에 그것을 바꿀 수있다 –

답변

0

PHP 스크립트는 아마 응답이 gzip으로 압축 전송하는 GZIP을 해제하는 모든 아이디어는 - 당신이 너무 거기에 GZIP을 해제 할 수 있는지 확인해야합니다. PHP에서 GZIP을 가능하게하는 한 가지 방법은 ob_start("ob_gzhandler");을 사용하는 것입니다, 그래서 당신은 ob_start();

관련 문제