Universal Web App Server
NGINX Unit is a lightweight and versatile open-source server that has
two primary capabilities:
- serves static media assets,
- runs application code in seven languages.
Unit compresses several layers of the modern application stack into a potent,
coherent solution with a focus on performance, low latency, and scalability. It
is intended as a universal building block for any web architecture regardless
of its complexity, from enterprise-scale deployments to your pet’s homepage.
Its native RESTful JSON API enables dynamic
updates with zero interruptions and flexible configuration, while its
out-of-the-box productivity reliably scales to production-grade workloads. We
achieve that with a complex, asynchronous, multithreading architecture
comprising multiple processes to ensure security and robustness while getting
the most out of today’s computing platforms.
Quick Installation
macOS
$ brew install nginx/unit/unit
For details and available language packages, see the
docs.
Docker
For a description of image tags, see the
docs.
Amazon Linux, Fedora, RedHat
$ wget https://raw.githubusercontent.com/nginx/unit/master/tools/setup-unit && chmod +x setup-unit # ./setup-unit repo-config && yum install unit # ./setup-unit welcome
For details and available language packages, see the
docs.
Debian, Ubuntu
$ wget https://raw.githubusercontent.com/nginx/unit/master/tools/setup-unit && chmod +x setup-unit # ./setup-unit repo-config && apt install unit # ./setup-unit welcome
For details and available language packages, see the
docs.
Running a Hello World App
Unit runs apps in a
variety of languages.
Let’s consider a basic example,
choosing PHP for no particular reason.
Suppose you saved a PHP script as /www/helloworld/index.php
:
echo "Hello, PHP ?phpspan>