2016-12-03 119 views
0

正如標題所說,Nginx Gzip不能正常工作,我嘗試過許多配置分散在互聯網上,沒有任何工作,當簡單的東西不起作用時,我感到非常沮喪。Nginx gzip在Chrome中不能正常工作

gzip.conf:

gzip on; 
gzip_disable "msie6"; 
gzip_vary on; 
gzip_proxied any; 
gzip_comp_level 6; 
gzip_buffers 16 8k; 
gzip_http_version 1.1; 
gzip_min_length 256; 
gzip_types 
    text/plain 
    text/css 
    application/json 
    application/javascript 
    application/x-javascript 
    text/xml 
    application/xml 
    application/xml+rss 
    text/javascript 
    application/vnd.ms-fontobject 
    application/x-font-ttf 
    font/opentype 
    image/svg+xml 
    image/x-icon; 

Chrome:

enter image description here

enter image description here

Chrome Audit: enter image description here

Curl: enter image description here

我清除了緩存,一切仍然一樣。

=======================

UPDATE:

我已經測試了gzip壓縮在

http://checkgzipcompression.com/

,給了我:

enter image description here

但在Chrome它表明:

enter image description here

+0

任何人都可以幫助解決這個問題?我已經嘗試了一切。 –

+0

增加了更多的截圖 –

回答

1

罪魁禍首是我的反病毒,我還以爲是不是因爲在第一,我有禁用它並且響應仍然不是gzipped。但是當我在我的工作區中使用相同的chrome版本的新安裝的VM中嘗試時,響應得到gzipped,並且當我在該VM上安裝防病毒時,響應不再是gzipped

1

由於gzip的正常工作的服務器上與其他HTTP客戶端(curlhttp://checkgzipcompression.com),但不是在Chrome,我會懷疑鉻是罪魁禍首,而不是你的nginx組態。

  1. 嘗試其他瀏覽器(FirefoxIEOpera等)?
  2. 嘗試禁用所有Chrome擴展(與用戶代理什麼,因爲你在你的nginx的conf有gzip_disable "msie6"
相關問題