Check out how OpenResty XRay helps organizations troubleshoot issues and optimize the performance of their applications.

Learn More LIVE DEMO

OpenResty is a full web platform built on nginx and LuaJIT. It lets you build high-performance web applications, API gateways, and WAFs entirely in Lua — without sacrificing nginx’s throughput. Whether you are deploying a new edge node or migrating from stock nginx, you need a reliable way to install OpenResty on your operating system.

There are two paths. Package manager installation (recommended for production) gives you signed, tested binaries with automatic updates via apt, dnf, or apk. Building from source suits advanced users who need custom nginx modules, non-standard install prefixes, or platforms without pre-built packages.

This page is the hub for both approaches — an OpenResty installation guide covering every major Linux distribution, ARM64, Alpine, and macOS. Pick your platform below, or jump to the Quick Start if you are on Ubuntu or Debian. Once OpenResty is running, the OpenResty Tutorial → is the recommended next step — a seven-step hands-on series from Hello World to production Lua applications.

Supported Platforms

OpenResty provides official pre-built packages for the following platforms. All listed Linux distributions also support ARM64 / Aarch64 — use the architecture-specific repository URL noted in each guide.

PlatformVersionsStatusDetailed Guide
Ubuntu20.04, 22.04, 24.04✅ SupportedInstall OpenResty on Ubuntu →
Debian11, 12, 13✅ SupportedInstall OpenResty on Debian →
RHEL / Rocky / Alma / CentOS Stream7, 8, 9✅ SupportedSee official RPM package instructions →
ARM64 / Aarch64Cross-distro✅ SupportedARM64 section below
Alpine Linux3.10 – 3.18✅ SupportedAlpine section below
macOS (Homebrew)Latest✅ SupportedmacOS section below
Build from sourceAny Linux / Unix✅ SupportedSource build section below

For the full list of supported distributions — including Fedora, Amazon Linux, Rocky Linux, and SUSE — see the official Linux Packages page.

Quick Start

The fastest way to install OpenResty on Ubuntu or Debian (amd64) takes five commands. These steps work on Ubuntu 22.04+ and Debian 11+; older releases may use a slightly different GPG key setup — see the full Ubuntu guide for details.

Step 1 — Install prerequisites:

sudo apt-get -y install --no-install-recommends wget gnupg ca-certificates lsb-release

Step 2 — Import the OpenResty GPG key:

wget -O - https://openresty.org/package/pubkey.gpg | sudo gpg --dearmor -o /usr/share/keyrings/openresty.gpg

Step 3 — Add the official APT repository:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openresty.gpg] https://openresty.org/package/ubuntu $(lsb_release -sc) main" \
    | sudo tee /etc/apt/sources.list.d/openresty.list > /dev/null

For Debian, replace ubuntu with debian in the URL above. For ARM64 systems, use arm64/ubuntu or arm64/debian instead — see the ARM64 section.

Step 4 — Update the package index and install:

sudo apt-get update
sudo apt-get -y install --no-install-recommends openresty

Step 5 — Start the service and verify:

sudo systemctl start openresty
curl 127.0.0.1/

You should see the default OpenResty welcome page. For a full walkthrough with screenshots and optional packages, see the complete Ubuntu installation guide →.

Platform Installation Guides

Ubuntu (20.04 / 22.04 / 24.04)

OpenResty provides official APT repositories for all current Ubuntu LTS releases on both amd64 and arm64. The installation process covers GPG key setup, repository configuration, package installation, and optional tools like resty, restydoc, and OPM.

Install OpenResty on Ubuntu — full step-by-step guide →

Debian (11 / 12 / 13)

Debian uses a dedicated APT repository separate from Ubuntu. The repo supports Bullseye (11), Bookworm (12), and Trixie (13) on both x86_64 and aarch64 architectures.

Install OpenResty on Debian — full step-by-step guide →

RHEL / Rocky / Alma / CentOS Stream

RHEL-family distributions use the same YUM/DNF repository model. Enable the official openresty.repo, then install with dnf install openresty. This covers CentOS 7/8/9, RHEL 7/8/9, Rocky Linux, AlmaLinux, and Oracle Linux.

See official RPM package instructions →

For a CentOS 8-specific walkthrough with screenshots, see our legacy CentOS 8 guide.

ARM64 / Aarch64

OpenResty provides dedicated ARM64 package repositories for Ubuntu, Debian, and all RPM-based distributions (CentOS, RHEL, Rocky, Fedora). The only difference from amd64 installs is the repository URL.

Ubuntu (ARM64)

After importing the GPG key (same as amd64), use the ARM64 repository:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openresty.gpg] https://openresty.org/package/arm64/ubuntu $(lsb_release -sc) main" \
    | sudo tee /etc/apt/sources.list.d/openresty.list > /dev/null
sudo apt-get update
sudo apt-get -y install openresty

Debian (ARM64)

codename=$(grep -Po 'VERSION="[0-9]+ \(\K[^)]+' /etc/os-release)

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openresty.gpg] https://openresty.org/package/arm64/debian $codename openresty" \
    | sudo tee /etc/apt/sources.list.d/openresty.list
sudo apt-get update
sudo apt-get -y install openresty

CentOS / RHEL / Rocky / Fedora (ARM64)

The RPM repository setup is identical to the x86_64 procedure — the same openresty.repo file serves both architectures. Follow the RHEL family installation guide and run dnf install openresty as usual; DNF automatically selects the correct aarch64 packages.

For Fedora specifically:

sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://openresty.org/package/fedora/openresty.repo
sudo dnf install -y openresty

See the official Linux Packages page for the complete list of ARM64-supported distributions.

Alpine Linux

Alpine uses apk instead of apt or dnf. First, enable Alpine’s community repository by uncommenting the community line in /etc/apk/repositories:

https://mirror.leaseweb.com/alpine/v3.18/community

Your mirror URL and version number may differ. Then add the OpenResty repository:

# Add the public key used to sign the repo
wget 'https://openresty.org/package/admin@openresty.com-5ea678a6.rsa.pub'
sudo mv 'admin@openresty.com-5ea678a6.rsa.pub' /etc/apk/keys/

# Add the repo (adjust MAJOR_VER to your Alpine version)
. /etc/os-release
MAJOR_VER=$(echo $VERSION_ID | sed 's/\.[0-9]\+$//')

echo "https://openresty.org/package/alpine/v$MAJOR_VER/main" \
    | sudo tee -a /etc/apk/repositories

sudo apk update
sudo apk add openresty

Optional packages: openresty-resty (CLI REPL), openresty-opm (Lua module manager), and openresty-restydoc (documentation browser). See Linux Packages: Alpine for details.

macOS (Homebrew)

On macOS, the recommended way to install OpenResty is via Homebrew:

brew install openresty/brew/openresty

If you previously installed nginx from homebrew/nginx, run brew untap homebrew/nginx first. For full macOS installation and source-build instructions, see the official Installation page.

Building from Source

Building from source gives you full control over compile-time options — custom nginx modules, non-default prefixes, and platforms without pre-built packages. The basic steps are:

tar -xvf openresty-VERSION.tar.gz
cd openresty-VERSION/
./configure -j2 --with-pcre-jit --with-ipv6
make -j2
sudo make install
export PATH=/usr/local/openresty/bin:$PATH

Replace VERSION with the latest release number from the Download page. Use ./configure --help to see all available options, including --add-module=PATH for third-party nginx modules.

Install build prerequisites first:

  • Debian / Ubuntu: sudo apt-get install libpcre3-dev libssl-dev perl make build-essential curl
  • RHEL / Fedora: sudo dnf install pcre-devel openssl-devel gcc curl zlib-devel

For the complete source build guide — including dependency management, configure options, and troubleshooting — see the official Installation documentation.

Verify Your Installation

After installing OpenResty on any platform, run these checks to confirm everything is working. This section applies to all distributions — child guides link back here instead of repeating the same steps.

Check the version

openresty -V

This prints the OpenResty version, nginx version, and enabled modules. You should see output starting with something like nginx version: openresty/1.31.1.1.

Start the default server

sudo systemctl start openresty    # systemd-based distros
sudo openresty                    # Alpine or manual installs

Confirm nginx worker processes are running:

ps aux | grep nginx

Test the default home page

curl 127.0.0.1/

A successful response shows the OpenResty welcome page HTML.

Install optional tools

The base openresty package does not include the CLI utilities. Install them separately from the same repository:

PackageCommandPurpose
openresty-restyresty -e 'print("Hello")'Lua REPL for quick scripting
openresty-restydocrestydoc -s content_by_lua_fileBrowse nginx/OpenResty docs in the terminal
openresty-opmopm get pintsized/lua-resty-httpInstall community Lua modules

Example on Debian/Ubuntu:

sudo apt-get -y install openresty-resty openresty-restydoc openresty-opm
resty -e 'print("Hello Resty")'

On RHEL-family systems, replace apt-get install with dnf install. On Alpine, use apk add openresty-resty openresty-opm openresty-restydoc.

Enable OpenResty at boot

sudo systemctl enable openresty

Upgrading OpenResty

To upgrade all installed OpenResty packages to the latest version:

Debian / Ubuntu:

sudo apt-get update
sudo apt-get --only-upgrade -y install 'openresty*'

RHEL / Rocky / Alma / CentOS:

sudo dnf check-update
sudo dnf upgrade 'openresty*'

Alpine:

sudo apk update
sudo apk upgrade openresty

FAQ

What is OpenResty used for?

OpenResty turns nginx into a programmable application server. Developers use it to build high-performance web APIs, reverse proxies, load balancers, WAFs, and CDN edge nodes — all scripted in Lua with LuaJIT’s near-native execution speed. Major companies including Cloudflare and Taobao rely on OpenResty at scale.

Is OpenResty the same as Nginx?

No. OpenResty bundles a patched nginx core with LuaJIT and dozens of Lua libraries (lua-nginx-module, ngx_lua, lua-resty-*). You get nginx’s event-driven architecture plus a full scripting runtime. The openresty command replaces nginx and is API-compatible with standard nginx configuration.

Which Linux distros does OpenResty support?

OpenResty provides official pre-built packages for Ubuntu, Debian, CentOS, RHEL, Rocky Linux, AlmaLinux, Fedora, Amazon Linux, Alpine, OpenSUSE, SUSE Linux Enterprise, Oracle Linux, and several China-specific distributions (Alibaba Cloud Linux, TencentOS). Both x86_64 and ARM64/aarch64 are supported on most of these. See the Linux Packages page for the full matrix.

How do I upgrade OpenResty to the latest version?

Run your package manager’s update command scoped to OpenResty packages. On Debian/Ubuntu: sudo apt-get update && sudo apt-get --only-upgrade -y install 'openresty*'. On RHEL-family: sudo dnf upgrade 'openresty*'. On Alpine: sudo apk upgrade openresty. For source builds, download the latest tarball and re-run ./configure && make && sudo make install.

If you found this guide useful, subscribe to this blog and our YouTube channel for more OpenResty tutorials.

About The Author

Yichun Zhang (Github handle: agentzh), is the original creator of the OpenResty® open-source project and the CEO of OpenResty Inc..

Yichun is one of the earliest advocates and leaders of “open-source technology”. He worked at many internationally renowned tech companies, such as Cloudflare, Yahoo!. He is a pioneer of “edge computing”, “dynamic tracing” and “machine coding”, with over 22 years of programming and 16 years of open source experience. Yichun is well-known in the open-source space as the project leader of OpenResty®, adopted by more than 40 million global website domains.

OpenResty Inc., the enterprise software start-up founded by Yichun in 2017, has customers from some of the biggest companies in the world. Its flagship product, OpenResty XRay, is a non-invasive profiling and troubleshooting tool that significantly enhances and utilizes dynamic tracing technology. And its OpenResty Edge product is a powerful distributed traffic management and private CDN software product.

As an avid open-source contributor, Yichun has contributed more than a million lines of code to numerous open-source projects, including Linux kernel, Nginx, LuaJIT, GDB, SystemTap, LLVM, Perl, etc. He has also authored more than 60 open-source software libraries.