0
我有用php-fpm + opcache配置的nginx(可能是opcache是問題,但是我對此有疑問)。 所以:nginx fpm gzip壓縮不起作用
cat /etc/nginx/conf.d/gzip.conf
gzip on;
gzip_proxied any;
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_disable "msie6";
phpinfo()函數輸出:
Phar
Phar: PHP Archive support enabled
Phar EXT version 2.0.1
Phar API version 1.1.1
SVN revision $Id: ec8e5fbde7521bb0b03975e5c086f4e10830b36f $
Phar-based phar archives enabled
Tar-based phar archives enabled
ZIP-based phar archives enabled
gzip compression enabled
bzip2 compression enabled
OpenSSL support enabled
螢火蟲響應頭:
Connection Keep-Alive
Content-Type application/json;charset=utf-8
Date Wed, 16 Apr 2014 09:37:54 GMT
Proxy-Connection Keep-Alive
Server nginx/1.4.1 (Ubuntu)
Transfer-Encoding chunked
Vary Accept-Encoding
Via 1.1 MSFWX
x-powered-by PHP/5.5.3-1ubuntu2.2
PS應用/ JSON是由報頭和gzip_types支持,我的猜測是,一個opcache模塊(最近啓用,此時gzip停止運行),因爲將php代碼的編譯位放入RAM中,並且從不gzip。我現在應該通過ob_start("ob_gzhandler")
來壓縮嗎?
響應有多大? – VBart