Binary Releases

Prebuilt Packages for Linux and BSD

Most Linux distributions and BSD variants have NGINX in the usual package repositories and they can be installed via whatever method is normally used to install software (apt on Debian, emerge on Gentoo, ports on FreeBSD, etc).

Be aware that these packages are often somewhat out-of-date. If you want the latest features and bugfixes, it’s recommended to build from source or use packages directly from

Official Red Hat/CentOS packages

To add NGINX yum repository, create a file named /etc/yum.repos.d/nginx.repo and paste one of the configurations below:


name=nginx repo


name=nginx repo

Due to differences between how CentOS, RHEL, and Scientific Linux populate the $releasever variable, it is necessary to manually replace $releasever with either 5 (for 5.x) or 6 (for 6.x), depending upon your OS version.

Official Debian/Ubuntu packages


The available NGINX Ubuntu release support is listed at this distribution page. For a mapping of Ubuntu versions to release names, please visit the Official Ubuntu Releases page.

Append the appropriate stanza to /etc/apt/sources.list. If there is concern about persistence of repository additions (i.e. DigitalOcean Droplets), the appropriate stanza may instead be added to a different list file under /etc/apt/sources.list.d/, such as /etc/apt/sources.list.d/nginx.list.

## Replace $release with your corresponding Ubuntu release.
deb $release nginx
deb-src $release nginx

e.g. Ubuntu 20.04 (Focal Fossa):

deb focal nginx
deb-src focal nginx

To install the packages, execute in your shell:

sudo apt update
sudo apt install nginx

If a W: GPG error: focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY $key is encountered during the NGINX repository update, execute the following:

## Replace $key with the corresponding $key from your GPG error.
sudo apt-key adv --keyserver --recv-keys $key
sudo apt update
sudo apt install nginx

You have now nginx installed on your server but not ready to serve web pages. you have to start the nginx. You can do this by using this command:

sudo systemctl start nginx

Debian 6:

Append the appropriate stanza to /etc/apt/sources.list.

deb squeeze nginx
deb-src squeeze nginx

Ubuntu PPA

This PPA is maintained by volunteers and is not distributed by It has some additional compiled-in modules and may be more fitting for your environment.

You can get the latest stable version of NGINX from the NGINX PPA on Launchpad: You will need to have root privileges to perform the following commands.

For Ubuntu 20.04 and newer:

sudo -s
nginx=stable # use nginx=development for latest development version
add-apt-repository ppa:nginx/$nginx
apt update
apt install nginx

If you get an error about add-apt-repository not existing, you will want to install python-software-properties. For other Debian/Ubuntu based distributions, you can try the lucid variant of the PPA which is the most likely to work on older package sets:

sudo -s
nginx=stable # use nginx=development for latest development version
echo "deb$nginx/ubuntu lucid main" > /etc/apt/sources.list.d/nginx-$nginx-lucid.list
apt-key adv --keyserver --recv-keys C300EE8C
apt update
apt install nginx

Official Win32 Binaries

As of NGINX 0.8.50, NGINX is now available as an official Windows binary.


cd c:\
ren nginx-1.2.3 nginx
cd nginx
start nginx


nginx -s [ stop | quit | reopen | reload ]

For problems look in c:nginxlogserror.log or in EventLog.

In addition, Kevin Worthington maintains earlier Windows builds of the development branch.

Source Releases

There are currently two versions of NGINX available: stable (1.20.x), mainline (1.21.x). The mainline branch gets new features and bugfixes sooner but might introduce new bugs as well. Critical bugfixes are backported to the stable branch.

In general, the stable release is recommended, but the mainline release is typically quite stable as well. See the FAQ.


25 May 2021


25 May 2021

Source code repository is at

Older versions can be found here.

Building NGINX From Source

After extracting the source, run these commands from a terminal:

sudo make install

By default, NGINX will be installed in /usr/local/nginx. You may change this and other options with the Installation and Compile-Time Options.

You might also want to peruse the 3rd party modules, since these must be built at compile-time.

You can follow this guide for more detailed instruction for building nginx from source

Other Systems


These pages are not thoroughly, if at all, reviewed for accuracy as they are on this page.

After Installing

There are many different example configurations that can be found in Getting Started section. Also the Pitfalls and Common Mistakes page will help keep you from making mistakes that so many users before you did.