Navigation

Install

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-get 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 nginx.org.

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.

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.

If a W:GPGerror:http://nginx.org/packages/ubuntuxenialRelease:Thefollowingsignaturescouldn'tbeverifiedbecausethepublickeyisnotavailable:NO_PUBKEY$key is encountered during the NGINX repository update, execute the following:

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:

There are currently two versions of NGINX available: stable(1.10.x), mainline(1.11.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.