{"id":13788840,"url":"https://github.com/tokers/zstd-nginx-module","last_synced_at":"2025-04-06T02:46:54.760Z","repository":{"id":41131299,"uuid":"152521348","full_name":"tokers/zstd-nginx-module","owner":"tokers","description":"Nginx modules for the Zstandard compression","archived":false,"fork":false,"pushed_at":"2024-04-22T08:51:49.000Z","size":70,"stargazers_count":205,"open_issues_count":23,"forks_count":25,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-05T13:36:15.963Z","etag":null,"topics":["nginx","nginx-module","zstd"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tokers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-11T02:50:44.000Z","updated_at":"2025-02-28T17:55:59.000Z","dependencies_parsed_at":"2022-09-07T20:21:22.858Z","dependency_job_id":"ba24ac6f-360e-4d58-b79d-19deb691307b","html_url":"https://github.com/tokers/zstd-nginx-module","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokers%2Fzstd-nginx-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokers%2Fzstd-nginx-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokers%2Fzstd-nginx-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokers%2Fzstd-nginx-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tokers","download_url":"https://codeload.github.com/tokers/zstd-nginx-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247426985,"owners_count":20937197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nginx","nginx-module","zstd"],"created_at":"2024-08-03T21:00:54.488Z","updated_at":"2025-04-06T02:46:54.739Z","avatar_url":"https://github.com/tokers.png","language":"C","readme":"# Name\nzstd-nginx-module - Nginx module for the [Zstandard compression](https://facebook.github.io/zstd/).\n\n# Table of Content\n\n* [Name](#name)\n* [Status](#status)\n* [Synopsis](#synopsis)\n* [Installation](#installation)\n* [Directives](#directives)\n  * [ngx_http_zstd_filter_module](#ngx_http_zstd_filter_module)\n    * [zstd_dict_file](#zstd_dict_file)\n    * [zstd](#zstd)\n    * [zstd_comp_level](#zstd_comp_level)\n    * [zstd_min_length](#zstd_min_length)\n    * [zstd_types](#zstd_types)\n    * [zstd_buffers](#zstd_buffers)\n  * [ngx_http_zstd_static_module](#ngx_http_zstd_static_module)\n    * [zstd_static](#zstd_static)\n* [Variables](#variables)\n  * [ngx_http_zstd_filter_module](#ngx_http_zstd_filter_module)\n    * [$zstd_ratio](#$zstd_ratio)\n* [Author](#author)\n\n# Status\n\nThis Nginx module is currently considered experimental. Issues and PRs are welcome if you encounter any problems.\n\n# Synopsis\n\n```nginx\n\n# specify the dictionary\nzstd_dict_file /path/to/dict;\n\nserver {\n    listen 127.0.0.1:8080;\n    server_name localhost;\n\n    location / {\n        # enable zstd compression\n        zstd on;\n        zstd_min_length 256; # no less than 256 bytes\n        zstd_comp_level 3; # set the level to 3\n\n        proxy_pass http://foo.com;\n    }\n}\n\nserver {\n    listen 127.0.0.1:8081;\n    server_name localhost;\n\n    location / {\n        zstd_static on;\n        root html;\n    }\n}\n```\n\n# Installation\n\nTo use theses modules, configure your nginx branch with `--add-module=/path/to/zstd-nginx-module`. Several points should be taken care.\n\n* You can set environment variables `ZSTD_INC` and `ZSTD_LIB` to specify the path to `zstd.h` and the path to zstd shared library represently.\n* static library will be tried prior to dynamic library, since this Nginx module uses some **advanced APIs** where static linking is recommended.\n* System's zstd bundle will be linked if `ZSTD_INC` and `ZSTD_LIB` are not specified.\n* Both `ngx_http_zstd_static_module` and `ngx_http_zstd_filter_module` will be configured.\n\n# Directives\n\n## ngx_http_zstd_filter_module\n\nThe `ngx_http_zstd_filter_module` module is a filter that compresses responses using the \"zstd\" method. This often helps to reduce the size of transmitted data by half or even more.\n\n### zstd_dict_file\n\n**Syntax:** *zstd_dict_file /path/to/dict;*  \n**Default:** *-*  \n**Context:** *http*  \n\nSpecifies the external dictionary.\n\n**WARNING:** Be careful! The content-coding registration only specifies a means to signal the use of the zstd format, and does not additionally specify any mechanism for advertising/negotiating/synchronizing the use of a specific dictionary between client and server. Use the `zstd_dict_file` only if you can insure that both ends (server and client) are capable of  using the same dictionary (e.g. advertise with a HTTP header). See https://github.com/tokers/zstd-nginx-module/issues/2 for the details.\n\n### zstd\n\n**Syntax:** *zstd on | off;*  \n**Default:** *zstd off;*  \n**Context:** *http, server, location, if in location*\n\nEnables or disables zstd compression for response.\n\n### zstd_comp_level\n\n**Syntax:** *zstd_comp_level level;*  \n**Default:** *zstd_comp_level 1;*  \n**Context:** *http, server, location*\n\nSets a zstd compression level of a response. Acceptable values are in the range from 1 to `ZSTD_maxCLevel()`.\n\n### zstd_min_length\n\n**Syntax:** *zstd_min_length length;*  \n**Default:** *zstd_min_length 20;*  \n**Context:** *http, server, location*\n\nSets the minimum length of a response that will be compressed by zstd. The length is determined only from the \"Content-Length\" response header field.\n\n### zstd_types\n\n**Syntax:** *zstd_types mime-type ...;*  \n**Default:** *zstd_types text/html;*  \n**Context:** *http, server, location*\n\nEnables ztd of responses for the specified MIME types in addition to \"text/html\". The special value \"*\" matches any MIME type.\n\n### zstd_buffers\n\n**Syntax:** *zstd_buffers number size;*  \n**Default:** *zstd_buffers 32 4k | 16 8k;*  \n**Context:** *http, server, location*\n\nSets the number and size of buffers used to compress a response. By default, the buffer size is equal to one memory page. This is either 4K or 8K, depending on a platform.\n\n## ngx_http_zstd_static_module\n\nThe `ngx_http_zstd_static_module` module allows sending precompressed files with the \".zst\" filename extension instead of regular files.\n\n### zstd_static\n\n**Syntax:**\t*zstd_static on | off | always;*  \n**Default:** *zstd_static off;*  \n**Context:** *http, server, location*  \n\nEnables (\"on\") or disables (\"off\") checking the existence of precompressed files. The following directives are also taken into account: gzip_vary.\n\nWith the \"always\" value, \"zsted\" file is used in all cases, without checking if the client supports it.\n\n\n# Variables\n\n## ngx_http_zstd_filter_module\n\n### $zstd_ratio\n\nAchieved compression ratio, computed as the ratio between the original and compressed response sizes.\n\n# Author\n\nAlex Zhang (张超) zchao1995@gmail, UPYUN Inc.\n\n# License\n\nThis Nginx module is licensed under [BSD 2-Clause License](LICENSE).\n","funding_links":[],"categories":["Third Party Modules","C"],"sub_categories":["C Modules"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftokers%2Fzstd-nginx-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftokers%2Fzstd-nginx-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftokers%2Fzstd-nginx-module/lists"}