2017-04-15 50 views
0

我有一些服務運行在dotnet核心和紅隼,與nginx面前。我不能讓nginx的紅隼面前服務gzip內容

但由於某種原因,它不會服務gzip-content,即使我配置了這樣做。

我產生nginx的配置看起來如下:

worker_processes 1; 
events { 
    worker_connections 1024; 
} 
http { 
    include mime.types; 
    default_type application/octet-stream; 
    keepalive_timeout   65; 
    gzip      on; 
    gzip_http_version 1.1; 
    gzip_comp_level 5; 
    gzip_min_length 1000; 
    gzip_proxied  any; 
    gzip_vary   on; 
    gzip_types 
     text/css 
     text/* 
     text/javascript 
     message/* 
     application/x-javascript 
     application/json 
     application/xml 
     application/atom+xml 
     application/xaml+xml; 
    proxy_buffer_size   128k; 
    proxy_buffers    4 256k; 
    proxy_busy_buffers_size 256k; 
    upstream GatewayService { 
     server 10.0.0.6:65053 backup; 
     server 10.0.0.5:59957 backup; 
     server 10.0.0.4:49210 ; 
    } 
    upstream EarthML_IdentityService { 
     server 10.0.0.6:64872 backup; 
     server 10.0.0.5:59896 backup; 
     server 10.0.0.4:49211 ; 
    } 
    upstream EarthML_Mapify_Portal { 
     server 10.0.0.6:54063 backup; 
     server 10.0.0.4:49204 ; 
     server 10.0.0.5:65360 backup; 
    } 
    upstream EarthMLFront { 
     server 10.0.0.6:65295 backup; 
     server 10.0.0.5:60387 backup; 
     server 10.0.0.4:49199 ; 
    } 
    upstream S-Innovations_StorageServiceHost { 
     server 10.0.0.6:53041 backup; 
     server 10.0.0.4:49195 ; 
     server 10.0.0.5:64536 backup; 
    } 
    server { 
     listen  8498; 
     listen  8500 ssl; 
     server_name www.earthml.com; 

     ssl_certificate D:\\SvcFab\_App\S-Innovations.ServiceFabric.GatewayApplicationType_App15\work/letsencrypt/www.earthml.com.fullchain.pem; 
     ssl_certificate_key D:\\SvcFab\_App\S-Innovations.ServiceFabric.GatewayApplicationType_App15\work/letsencrypt/www.earthml.com.key; 
     ssl_session_timeout 5m; 
     ssl_prefer_server_ciphers on; 
     ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 
     ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA'; 
     add_header Strict-Transport-Security max-age=15768000; 
     location /manage/ { 
      proxy_pass http://GatewayService/; 
      server_name_in_redirect on; 
      port_in_redirect off; 
      proxy_set_header Upgrade $http_upgrade; 
      proxy_set_header Connection keep-alive; 
      proxy_set_header Host      $host; 
      proxy_set_header X-Real-IP    $remote_addr; 
      proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for; 
      proxy_set_header X-Forwarded-Host  $host; 
      proxy_set_header X-Forwarded-Server  $host; 
      proxy_set_header X-Forwarded-Proto  $scheme; 
      proxy_set_header X-Forwarded-Path  $request_uri; 
      proxy_set_header X-ServiceFabric-Key "S-Innovations.ServiceFabric.GatewayApplication/GatewayService/1.0.0.20170415.02"; 
      proxy_connect_timeout     3s; 
      proxy_http_version      1.1; 
      proxy_set_header X-Forwarded-PathBase /manage/; 
      proxy_cache_bypass $http_upgrade; 
     } 
     location /identity/ { 
      proxy_pass http://EarthML_IdentityService/; 
      server_name_in_redirect on; 
      port_in_redirect off; 
      proxy_set_header Upgrade $http_upgrade; 
      proxy_set_header Connection keep-alive; 
      proxy_set_header Host      $host; 
      proxy_set_header X-Real-IP    $remote_addr; 
      proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for; 
      proxy_set_header X-Forwarded-Host  $host; 
      proxy_set_header X-Forwarded-Server  $host; 
      proxy_set_header X-Forwarded-Proto  $scheme; 
      proxy_set_header X-Forwarded-Path  $request_uri; 
      proxy_set_header X-ServiceFabric-Key "EarthML.IdentityServerApp/EarthML.IdentityService/1.0.0.20170413.02"; 
      proxy_connect_timeout     3s; 
      proxy_http_version      1.1; 
      proxy_set_header X-Forwarded-PathBase /identity/; 
      proxy_cache_bypass $http_upgrade; 
     } 
     location/{ 
      proxy_pass http://EarthMLFront/; 
      server_name_in_redirect on; 
      port_in_redirect off; 
      proxy_set_header Upgrade $http_upgrade; 
      proxy_set_header Connection keep-alive; 
      proxy_set_header Host      $host; 
      proxy_set_header X-Real-IP    $remote_addr; 
      proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for; 
      proxy_set_header X-Forwarded-Host  $host; 
      proxy_set_header X-Forwarded-Server  $host; 
      proxy_set_header X-Forwarded-Proto  $scheme; 
      proxy_set_header X-Forwarded-Path  $request_uri; 
      proxy_set_header X-ServiceFabric-Key "EarthML.WebFrontApplication/EarthMLFront/1.0.0.20170413.01"; 
      proxy_connect_timeout     3s; 
      proxy_http_version      1.1; 
      proxy_set_header X-Forwarded-PathBase /; 
      proxy_cache_bypass $http_upgrade; 
     } 
    } 

回答

0

我錯過了應用程序/ JavaScript的在類型列表中做的gzip上。