2017-01-23 3 views
0

Ich versuche herauszufinden, warum Nginx CSS nicht komprimiert. Nginx config sieht für diese Aufgaben als gültig und typisch aus.Nginx komprimiert CSS-Dateien nicht

fehlgeschlagen Test:

curl -H "Accept-Encoding: gzip" -I https://<hostname>/sites/default/files/css/css_xLFDRTFqZTZeUg7Pab0gP4cpz5TWo3PCH-KBo_HKQ6A.css 

HTTP/1.1 200 OK 
Server: nginx 
Content-Type: text/css 
Content-Length: 1123 
ETag: "587c4cdc-463" 
Cache-Control: max-age=2592000 
Accept-Ranges: bytes 

Die Antwort Content-Encoding sollte gzip statt text/css sein.

Nginx config:

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

Antwort

1

Ihre gzip_min_length gesetzt ist zu groß - Sie Content-Length in Ihrer Anfrage Debug- und seine Art und Weise kleiner als die Mindestschwelle zu sehen.

Entfernen Sie das Ganze oder setzen Sie es viel niedriger.

+0

Es funktioniert, danke! –