---
id: compression
title: Compressing JBrowse data
---


Scripts such as `flatfile-to-json.pl` and `prepare-refseqs.pl` offer a `--compress` option to compress (gzip) feature and sequence data to conserve server disk space and reduce server CPU load even further. Using this option requires some additional web server configuration.

In order to use this functionality


-   `AllowOverride FileInfo` (or `AllowOverride All`) must be set for the JBrowse data directories in order to use the `.htaccess` files generated by the formatting scripts.
-   `mod_headers` must be installed and enabled, and if the web server is using `mod_gzip` or `mod_deflate`, `mod_setenvif` must also be installed and enabled.

The reason for these things is that the items jsonz and txtz should not be "double gzipped" and be given proper response headers

For Apache: A configuration snippet like the following should be included in the configuration:
```
 <IfModule mod_gzip.c>
   mod_gzip_item_exclude "(\.jsonz|\.txtz)"
 </IfModule>
 <IfModule setenvif.c>
   SetEnvIf Request_URI "(\.jsonz|\.txtz)" no-gzip dont-vary
 </IfModule>
 <IfModule mod_headers.c>
   <FilesMatch "(\.jsonz|\.txtz)">
     Header onsuccess set Content-Encoding gzip
   </FilesMatch>
 </IfModule>
```
For nginx: A configuration snippet like the following should be included in the configuration:

```
  location ~* "\.(json|txt)z$" {
           add_header Content-Encoding  gzip;
           gzip off;
           types { application/json jsonz; }
  }
```

## Newer JBrowse versions

Note that many new data formats that JBrowse supports e.g.

* BigWig
* BAM
* GFF3Tabix
* BEDTabix
* VCFTabix
* TwoBit

These formats are already compressed and they do not require pre-processing.
