title: nginx gzip compression not working
body: <p>I have no idea where to place my gzip compression lines within my <code>http</code> block, shown here. </p>
  
  <pre><code>http {
      default_type application/octet-stream;
      include /etc/nginx/mime.types;
  
      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;
  
      keepalive_timeout 65;
  
      server {
  
          listen 8080;
  
          root /usr/share/nginx;
  
          location / {
              root /usr/share/nginx/html;
  
              try_files $uri /index.html;
  
              autoindex off;
          }
  
          location ~ ^/(images|fonts|videos)/ {
              root /usr/share/nginx/assets;
  
              autoindex                off;
              expires                  7d;
              proxy_redirect           off;
              proxy_max_temp_file_size 0;
  
          }
  
          location ~ \.(mp3|mp4) {
  
          }
      }
  
      include /etc/nginx/conf.d/*.conf;
  }
  </code></pre>
  
  <p>The lines I want to use for gzip compression are here, and I don't know whether to put these in the server block, before the server block, or in the location block:</p>
  
  <pre><code># Compression
  gzip on;
  gzip_proxied any;
  gzip_types text/plain text/xml text/css application/x-javascript;
  gzip_vary on;
  gzip_disable "MSIE [1-6]\.(?!.*SV1)";
  gzip_static on;
  </code></pre>
  
  <p>I have gzip_static set to "on" because I'm using <a href="https://github.com/jstuckey/gulp-gzip" rel="noreferrer">gulp-gzip</a> to compress various css and js files.</p>