{"id":13418135,"url":"https://github.com/nginx/unit","last_synced_at":"2025-05-12T15:32:56.539Z","repository":{"id":37271517,"uuid":"102627638","full_name":"nginx/unit","owner":"nginx","description":"NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.","archived":false,"fork":false,"pushed_at":"2025-04-30T17:53:17.000Z","size":13261,"stargazers_count":5511,"open_issues_count":264,"forks_count":346,"subscribers_count":126,"default_branch":"master","last_synced_at":"2025-05-06T05:50:41.329Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://unit.nginx.org","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nginx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-09-06T15:45:30.000Z","updated_at":"2025-05-06T04:35:23.000Z","dependencies_parsed_at":"2023-09-25T23:14:19.781Z","dependency_job_id":"9a79e4d8-660e-4444-a066-1edddf674cd2","html_url":"https://github.com/nginx/unit","commit_stats":{"total_commits":2801,"total_committers":50,"mean_commits":56.02,"dds":0.8182791860049983,"last_synced_commit":"5fde2ff79c92e2bb2ff67e4537640af7d06e73b6"},"previous_names":[],"tags_count":89,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nginx%2Funit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nginx%2Funit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nginx%2Funit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nginx%2Funit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nginx","download_url":"https://codeload.github.com/nginx/unit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253765789,"owners_count":21960791,"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":[],"created_at":"2024-07-30T22:00:58.837Z","updated_at":"2025-05-12T15:32:56.529Z","avatar_url":"https://github.com/nginx.png","language":"C","funding_links":[],"categories":["C","Service Mesh","Frameworks / Runtimes","others"],"sub_categories":[],"readme":"# NGINX Unit\n\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n[![CI](https://github.com/nginx/unit/actions/workflows/ci.yml/badge.svg)](https://github.com/nginx/unit/actions/workflows/ci.yml \"GitHub workflow CI\")\n[![GitHub Discussions](https://img.shields.io/badge/GitHub-discussions-009639)](https://github.com/nginx/unit/discussions \"GitHub Discussions\")\n\n## Universal Web App Server\n\n![NGINX Unit Logo](docs/unitlogo.svg)\n\nPlease see: [SUPPORT.md](/SUPPORT.md)\n\nNGINX Unit is a lightweight and versatile open-source server that has\ntwo primary capabilities:\n\n- serves static media assets,\n- runs application code in eight languages.\n\nUnit compresses several layers of the modern application stack into a potent,\ncoherent solution with a focus on performance, low latency, and scalability. It\nis intended as a universal building block for any web architecture regardless\nof its complexity, from enterprise-scale deployments to your pet's homepage.\n\nIts native [RESTful JSON API](#openapi-specification) enables dynamic\nupdates with zero interruptions and flexible configuration, while its\nout-of-the-box productivity reliably scales to production-grade workloads. We\nachieve that with a complex, asynchronous, multithreading architecture\ncomprising multiple processes to ensure security and robustness while getting\nthe most out of today's computing platforms.\n\n## Installation\n\n### macOS\n\nRun the following command to install both `unitd` (the Unit daemon) and `unitctl` (the control tool).\n\n``` console\n$ brew install nginx/unit/unit\n```\n\nFor details and available language packages, see the\n[docs](https://unit.nginx.org/installation/#homebrew).\n\n### Docker\n\n``` console\n$ docker pull unit:\u003cTAG\u003e\n$ mkdir /tmp/unit-control # customize as needed.\n$ docker run -d \\\n      --mount type=bind,src=/tmp/unit-control,dst=/var/run \\\n      --mount type=bind,src=.,dst=/www \\\n      --network host \\\n      unit\n```\n\nFor a description of image tags, see the\n[docs](https://unit.nginx.org/installation/#docker-images).\n\nWARNING: latest image tag may not provide support for specific language\nmodules, *do* check the available image tags from the link above before\npulling your image.\n\nYour current working directory will now be mounted to the Unit image at `/www`.\nYou can reach its socket at `/tmp/unit-control/control.unit.sock` assuming no\nfurther customizations have been made.\n\n### Debian, Ubuntu, Amazon Linux, Fedora, Red Hat\n\nThis helper script configures the correct package repositories for system.\n``` console\n$ wget https://raw.githubusercontent.com/nginx/unit/master/tools/setup-unit \u0026\u0026 chmod +x setup-unit\n# ./setup-unit repo-config\n```\n\nDebian derivatives:\n``` console\n# apt install unit\n```\n\nFedora derivatives:\n``` console\n# yum install unit\n```\n\nFor details and available language packages, see the\n[docs](https://unit.nginx.org/installation/#official-packages).\n\n## Getting Started with `unitctl`\n\n[`unitctl`](tools/README.md) streamlines the management of NGINX Unit processes\nthrough an easy-to-use command line interface. To get started with `unitctl`,\ndownload it from the\n[official GitHub releases](https://github.com/nginx/unit/releases)\nor [Homebrew](#macos).\n\n### Installation\n\n\u003e [!NOTE]\n\u003e If you installed Unit with [Homebrew](#macos), you can skip this step\n\u003e as `unitctl` is included by default.\n\nDownload the appropriate `unitctl` binary for your system from the\n[NGINX Unit releases](https://github.com/nginx/unit/releases/).\n\n``` console\n$ tar xzvf unitctl-master-x86_64-unknown-linux-gnu.tar.gz\n# mv unitctl /usr/local/bin/\n```\n\n\n## Launch Unit using Docker\nIf you have [Docker installed](https://docs.docker.com/engine/install/) on\nyour machine, and then you can effortlessly spin up one of\n[Unit's official Docker images](https://hub.docker.com/_/unit)\nalongside your application.\n\n\u003e [!TIP]\n\u003e How-to and configuration guides are available on\n[unit.nginx.org](https://unit.nginx.org/howto/) for web application frameworks\nbuilt with Python, PHP, WebAssembly, Node.js, Ruby, and more.\n\nHere's an example using the `unit:python` Docker image:\n``` console\n$ unitctl instances new 127.0.0.1:8001 /path/to/app 'unit:python'\n```\n\n`/path/to/app` will mount to `/www` in the Docker filesystem.\n\nSave this to `/path/to/app/wsgi.py`:\n```python\ndef application(environ, start_response):\n    start_response(\"200 OK\", [(\"Content-Type\", \"text/plain\")])\n    return (b\"Hello, Python on Unit!\")\n```\n\nYou can then interactively edit the currently active configuration:\n``` console\n$ unitctl edit\n```\n```jsonc\n{\n  \"listeners\": {\n    \"*:8000\": {\n      // Point listener to new application\n      \"pass\": \"applications/python\"\n    }\n  },\n\n  // Add an application definition\n  \"applications\": {\n    \"python\": {\n        \"type\": \"python\",\n        \"path\": \"/www/\",\n        \"module\": \"wsgi\"\n    }\n  }\n}\n```\nValid configurations will be applied upon save and close.\n\n``` console\n$ curl localhost:8000\n\nHello, Python on Unit!\n```\nMore Python configuration examples can be found in the\n[Unit docs](https://unit.nginx.org/howto/samples/#python).\n\n## Hello World with PHP and curl\n\nUnit runs apps in a\n[variety of languages](https://unit.nginx.org/howto/samples/).\nLet's explore the configuration of a simple PHP app on Unit with `curl`.\n\nSuppose you saved a PHP script as `/www/helloworld/index.php`:\n``` php\n\u003c?php echo \"Hello, PHP on Unit!\"; ?\u003e\n```\n\nTo run it on Unit with the `unit-php` module installed, first set up an\napplication object. Let's store our first config snippet in a file called\n`config.json`:\n\n``` json\n{\n    \"helloworld\": {\n        \"type\": \"php\",\n        \"root\": \"/www/helloworld/\"\n    }\n}\n```\n\nSaving it as a file isn't necessary, but can come in handy with larger objects.\n\nNow, `PUT` it into the `/config/applications` section of Unit's control API,\nusually available by default via a Unix domain socket:\n\n``` console\n# curl -X PUT --data-binary @config.json --unix-socket  \\\n       /path/to/control.unit.sock http://localhost/config/applications\n```\n``` json\n{\n\t\"success\": \"Reconfiguration done.\"\n}\n```\n\nNext, reference the app from a listener object in the `/config/listeners`\nsection of the API.  This time, we pass the config snippet straight from the\ncommand line:\n\n``` console\n# curl -X PUT -d '{\"127.0.0.1:8080\": {\"pass\": \"applications/helloworld\"}}'  \\\n       --unix-socket /path/to/control.unit.sock http://localhost/config/listeners\n```\n``` json\n{\n    \"success\": \"Reconfiguration done.\"\n}\n```\n\nNow Unit accepts requests at the specified IP and port, passing them to the\napplication process. Your app works!\n\n``` console\n$ curl 127.0.0.1:8080\n\n      Hello, PHP on Unit!\n```\n\nFinally, query the entire `/config` section of the control API:\n\n``` console\n# curl --unix-socket /path/to/control.unit.sock http://localhost/config/\n```\n\nUnit's output should contain both snippets, neatly organized:\n\n``` json\n{\n    \"listeners\": {\n        \"127.0.0.1:8080\": {\n            \"pass\": \"applications/helloworld\"\n        }\n    },\n\n    \"applications\": {\n        \"helloworld\": {\n            \"type\": \"php\",\n            \"root\": \"/www/helloworld/\"\n        }\n    }\n}\n```\n\n## WebAssembly\nUnit supports running WebAssembly Components (WASI 0.2).\nFor more information see the\n[Unit Configuration Docs](https://unit.nginx.org/configuration/#configuration-wasm).\n\n## OpenAPI Specification\n\nOur [OpenAPI specification](docs/unit-openapi.yaml) aims to simplify\nconfiguring and integrating NGINX Unit deployments and provide an authoritative\nsource of knowledge about the control API.\n\n## Community\n\n- The go-to place to start asking questions and share your thoughts is\n [GitHub Discussions](https://github.com/nginx/unit/discussions).\n\n- Our [GitHub issues page](https://github.com/nginx/unit/issues) offers\n  space for a more technical discussion at your own pace.\n\n- The [project map](https://github.com/orgs/nginx/projects/1) on\n  GitHub sheds some light on our current work and plans for the future.\n\n- Our [official website](https://unit.nginx.org/) may provide answers\n  not easily found otherwise.\n\n- Get involved with the project by contributing! See the\n  [contributing guide](CONTRIBUTING.md) for details.\n\n- To reach the team directly, subscribe to the\n  [mailing list](https://mailman.nginx.org/mailman/listinfo/unit).\n\n- For security issues, [email us](mailto:security-alert@nginx.org),\n  mentioning NGINX Unit in the subject and following the [CVSS\n  v3.1](https://www.first.org/cvss/v3.1/specification-document) spec.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnginx%2Funit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnginx%2Funit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnginx%2Funit/lists"}