This article explains how to install NGINX Plus on Red Hat Enterprise Linux, CentOS, Oracle Linux, Amazon Linux, Debian, Ubuntu, SLES and FreeBSD.

Table of Contents

Prerequisites

Prior to installing NGINX Plus, you should have:

Installing NGINX Plus on RHEL, CentOS, Oracle Linux and Amazon Linux

NGINX Plus can be installed on Red Hat Enterprise Linux, CentOS and Oracle Linux 5.10+, 6.5+ and 7.0+, and Amazon Linux.

To install NGINX Plus on RHEL, CentOS, Oracle Linux and Amazon Linux:

  1. Create the /etc/ssl/nginx directory:

    $ sudo mkdir /etc/ssl/nginx
    $ cd /etc/ssl/nginx
  2. Log in to NGINX Plus Customer Portal and download your version of nginx-repo.crt and nginx-repo.key files.
  3. Copy the files to /etc/ssl/nginx/ directory:

    $ sudo cp nginx-repo.crt /etc/ssl/nginx/
    $ sudo cp nginx-repo.key /etc/ssl/nginx/
  4. Install required dependencies.

    • For RHEL5, CentOS5 or Oracle Linux5, install OpenSSL:
      $ sudo yum install openssl
    • For RHEL6, RHEL7, CentOS6, CentOS7, Oracle Linux6, Oracle Linux7, and Amazon Linux install ca-certificates:
      $ sudo yum install ca-certificates
  5. Download the nginx-plus-repo file and copy it to the to /etc/yum.repos.d/ directory. Each version RHEL, CentOS, Oracle Linux or Amazon Linux has its own repo file.
    • For RHEL5, CentOS5 or Oracle Linux5, run the command:

      $ sudo wget -P /etc/yum.repos.d/ https://cs.nginx.com/static/files/nginx-plus-5.repo
    • For RHEL6, CentOS6 or Oracle Linux6 run the command:

      $ sudo wget -P /etc/yum.repos.d/ https://cs.nginx.com/static/files/nginx-plus-6.repo
    • For RHEL7, CentOS7 or Oracle Linux7 run the command:

      $ sudo wget -P /etc/yum.repos.d/ https://cs.nginx.com/static/files/nginx-plus-7.repo
    • For Amazon Linux run the command:

      $ sudo wget -P /etc/yum.repos.d https://cs.nginx.com/static/files/nginx-plus-amazon.repo
  6. Install the nginx-plus package. If there is an older NGINX Plus package installed, it will be replaced:

    $ sudo yum install nginx-plus

Installing NGINX Plus on Debian and Ubuntu

NGINX Plus can be installed on Debian 7 (Wheezy), Debian 8 (Jessie), Ubuntu 12.04 (Precise), Ubuntu 14.04 (Trusty), Ubuntu 16.04 (Xenial), and Ubuntu 16.10 (Yakkety).

To install NGINX Plus on Debian or Ubuntu:

  1. Create the /etc/ssl/nginx directory:

    $ sudo mkdir /etc/ssl/nginx
    $ cd /etc/ssl/nginx
  2. Log in to NGINX Plus Customer Portal.
  3. Download your version of nginx-repo.crt and nginx-repo.key files from NGINX Plus Customer Portal and copy the files to /etc/ssl/nginx/ directory:

    $ sudo cp nginx-repo.crt /etc/ssl/nginx/
    $ sudo cp nginx-repo.key /etc/ssl/nginx/
  4. Download the NGINX signing key from nginx.org and add it:

    $ sudo wget http://nginx.org/keys/nginx_signing.key
    $ sudo apt-key add nginx_signing.key
  5. Install apt-utils package and install NGINX Plus repository.

    • For Debian, run the commands:

      $ sudo apt-get install apt-transport-https lsb-release ca-certificates
      $ printf "deb https://plus-pkgs.nginx.com/debian `lsb_release -cs` nginx-plus\n" | sudo tee /etc/apt/sources.list.d/nginx-plus.list
    • For Ubuntu, run the commands:

      $ sudo apt-get install apt-transport-https lsb-release ca-certificates
      $ printf "deb https://plus-pkgs.nginx.com/ubuntu `lsb_release -cs` nginx-plus\n" | sudo tee /etc/apt/sources.list.d/nginx-plus.list
  6. Download the “90nginx” file to /etc/apt/apt.conf.d:

    $ sudo wget -q -O /etc/apt/apt.conf.d/90nginx https://cs.nginx.com/static/files/90nginx
  7. Update the repository information:

    $ sudo apt-get update
  8. Install the nginx-plus package. If there is an older NGINX Plus package installed, it will be replaced:

    $ sudo apt-get install -y nginx-plus

Installing NGINX Plus on SUSE Linux Enterprise Server

NGINX Plus can be installed on SUSE Linux Enterprise Server 12 and on SUSE Linux Enterprise Server 12 SP1.

To install NGINX Plus on SUSE Linux Enterprise Server:

  1. Create the /etc/ssl/nginx directory:

    $ sudo mkdir /etc/ssl/nginx
    $ cd /etc/ssl/nginx
  2. Log in to NGINX Plus Customer Portal.
  3. Download your version of nginx-repo.crt and nginx-repo.key files from NGINX Plus Customer Portal and create a file that contains an nginx-repo SSL certificate and key:

    $ cat /etc/ssl/nginx/nginx-repo.crt /etc/ssl/nginx/nginx-repo.key > /etc/ssl/nginx/nginx-repo-bundle.crt
  4. Install required dependencies:
    $ zypper install ca-certificates
  5. Add the nginx-plus repo:

    $ zypper addrepo -G -t yum -c 'https://plus-pkgs.nginx.com/sles/12?ssl_clientcert=/etc/ssl/nginx/nginx-repo-bundle.crt&ssl_verify=host' nginx-plus
  6. Install the nginx-plus package. If there is an older NGINX Plus package installed, it will be replaced:

    $ zypper install nginx-plus

Installing NGINX Plus on FreeBSD

NGINX Plus can be installed on FreeBSD 9.3, 10.1+ and 11.0.

To install NGINX Plus on FreeBSD:

  1. Create the /etc/ssl/nginx directory:

    $ sudo mkdir /etc/ssl/nginx
    $ cd /etc/ssl/nginx
  2. Log in to NGINX Plus Customer Portal.
  3. Download your version of nginx-repo.crt and nginx-repo.key files from /etc/ssl/nginx/ directory:

    $ sudo cp nginx-repo.crt /etc/ssl/nginx/
    $ sudo cp nginx-repo.key /etc/ssl/nginx/
  4. Copy nginx-plus.conf file to /etc/pkg/ directory:

    $ sudo wget -O /etc/pkg http://cs.nginx.com/static/files/nginx-plus.conf
  5. Add the following lines to the /usr/local/etc/pkg.conf file:

    PKG_ENV: { SSL_NO_VERIFY_PEER: "1",
    SSL_CLIENT_CERT_FILE: "/etc/ssl/nginx/nginx-repo.crt",
    SSL_CLIENT_KEY_FILE: "/etc/ssl/nginx/nginx-repo.key" }
  6. Install the nginx-plus package. If there is an older NGINX Plus package installed, it will be replaced:

    $ sudo pkg install nginx-plus

Installing Dynamically Loadable Modules

NGINX Plus ships with a number of dynamic modules that you can install directly from the modules repository. There are two types of dynamic modules:

To install the dynamically loadable modules, run the command (repeat the installation command for each module)

  • for RHEL, CentOS, Oracle Linux and Amazon Linux:
    # yum install module-name
  • for Debian or Ubuntu:
    # apt-get install module-name
  • for SUSE Linux Enterprise Server:
    # zypper install module-name
  • for FreeBSD:
    # pkg install module-name

Note that some modules are not available for certain OS versions because of OS limitations. For details as well as descriptions of the modules, see the NGINX Plus Technical Specifications.

The /etc/nginx/modules directory is created automatically with symbolic links to the installed locations of the .so files for the selected modules.

  • In the main (top-level) context in /etc/nginx/nginx.conf, add a load_module directive for each dynamically loadable module you installed.

    load_module modules/module-name.so;
  • Check the new configuration for syntactic validity and reload NGINX Plus.

    # nginx -t && nginx -s reload
  • Upgrading NGINX Plus

    To upgrade your NGINX Plus installation to the newest version:

    1. If you already have old NGINX packages in your system, back up your configs and logs.

      • For Linux distributions, run the commands:
        sudo cp -a /etc/nginx /etc/nginx-plus-backup
        sudo cp -a /var/log/nginx /var/log/nginx-plus-backup
      • For FreeBSD, run the commands:
        sudo cp -a /usr/local/etc/nginx /usr/local/etc/nginx-plus-backup
        sudo cp -a /var/log/nginx /var/log/nginx-plus-backup
    2. Upgrade your NGINX Plus installation.

      • for RHEL, CentOS, Oracle Linux or Amazon Linux, run the command:

        $ sudo yum upgrade nginx-plus
      • for Debian or Ubuntu, run the commands:

        $ sudo apt-get update
        $ sudo apt-get install nginx-plus
      • for FreeBSD, run the command:

        $ sudo pkg upgrade nginx-plus

    After the upgrade is finished, you may check the NGINX Plus version:

    $ nginx -v
    nginx version: nginx/1.11.5 (nginx-plus-r11)

    See Also