search close

Ubuntu Nginx 1.9 or lower

access_time Updated Dec 5, 2022

Add the package repositories

Add the version of the Ubuntu package repository that you want to use:

Ubuntu 22.04 - jammy

sudo apt update
sudo apt-get install -y apt-transport-https wget
wget -qO - https://apt.signalsciences.net/release/gpgkey | sudo apt-key add -
sudo echo "deb https://apt.signalsciences.net/release/ubuntu/ jammy main" | sudo tee /etc/apt/sources.list.d/sigsci-release.list && sudo apt-get update

Ubuntu 20.04 - focal

sudo apt update
sudo apt-get install -y apt-transport-https wget
wget -qO - https://apt.signalsciences.net/release/gpgkey | sudo apt-key add -
sudo echo "deb https://apt.signalsciences.net/release/ubuntu/ focal main" | sudo tee /etc/apt/sources.list.d/sigsci-release.list && sudo apt-get update

Ubuntu 18.04 - bionic

sudo apt update
sudo apt-get install -y apt-transport-https wget
wget -qO - https://apt.signalsciences.net/release/gpgkey | sudo apt-key add -
sudo echo "deb https://apt.signalsciences.net/release/ubuntu/ bionic main" | sudo tee /etc/apt/sources.list.d/sigsci-release.list && sudo apt-get update

Ubuntu 16.04 - xenial

sudo apt-get install -y apt-transport-https wget
wget -qO - https://apt.signalsciences.net/release/gpgkey | sudo apt-key add -
sudo echo "deb https://apt.signalsciences.net/release/ubuntu/ xenial main" | sudo tee /etc/apt/sources.list.d/sigsci-release.list && sudo apt-get update

Ubuntu 14.04 - trusty

sudo apt-get install -y apt-transport-https wget
wget -qO - https://apt.signalsciences.net/release/gpgkey | sudo apt-key add -
sudo echo "deb https://apt.signalsciences.net/release/ubuntu/ trusty main" | sudo tee /etc/apt/sources.list.d/sigsci-release.list && sudo apt-get update

Ubuntu 12.04 - precise

sudo apt-get install -y apt-transport-https wget
wget -qO - https://apt.signalsciences.net/release/gpgkey | sudo apt-key add -
sudo echo "deb https://apt.signalsciences.net/release/ubuntu/ precise main" | sudo tee /etc/apt/sources.list.d/sigsci-release.list && sudo apt-get update

Enable Lua for Nginx

Some older versions of Nginx don’t support native loading of Lua modules. Therefore, we require Nginx to be built with the third party ngx_lua module. Because most older versions of Nginx do not support dynamically loadable modules, you will likely need to rebuild Nginx from source.

To assist you, we provide pre-built drop-in replacement Nginx packages already built with the ngx_lua module. This is intended for users who prefer not to build from source, or who either use a distribution-provided package or an official Nginx provided package. These pre-built packages are built to support much older distributions and are not gpg signed.

Flavors

We support three “flavors” of Nginx. These flavors are based on what upstream package we’ve based our builds on. All our package flavors are built according to the official upstream maintainer’s build configuration with the addition of the ngx_lua and ngx_devel_kit modules.

Our provided flavors are:

  • Distribution: the distribution flavor is based off the official distribution-provided Nginx packages. For Debian-based Linux distributions (Red Hat and Debian) these are the based off the official Debian Nginx packages.

  • Stable: the stable flavor is based off the official Nginx.org “stable” package releases.

  • Mainline: the mainline flavor is based off the official Nginx.org “mainline” package releases.

Flavor version support

The following versions are contained in the various OS and flavor packages:

OS Distribution Stable Mainline
Ubuntu 22.04 (Jammy) 1.18.0 N/A N/A
Ubuntu 20.04 (Focal) 1.18.0 N/A N/A
Ubuntu 18.04 (Bionic) 1.14.0 N/A N/A
Ubuntu 16.04 (Xenial) 1.10.3 N/A N/A
Ubuntu 15.04 (Vivid) 1.6.2 1.8.1 1.9.10
Ubuntu 14.04 (Trusty) 1.4.6 1.8.1 1.9.10
Ubuntu 12.04 (Precise) 1.1.19 1.8.1 1.9.10

The versions are dependent on the upstream package maintainer’s supported version.

Note: We do not provide a NGINX build for Ubuntu 16.04 and higher since Lua is supported. We only provide our dynamic Lua support modules for those versions.

Apt repository setup for Ubuntu systems

  1. Add the repository key:

    wget -qO - https://apt.signalsciences.net/nginx/gpg.key | sudo apt-key add -
    
  2. Create a new file /etc/apt/sources.list.d/sigsci-nginx.list with the following content based on your OS distribution and preferred flavor:

    • Distribution flavor

      OS sigsci-nginx.list content
      Ubuntu 15.04 (Vivid) deb https://apt.signalsciences.net/nginx/distro vivid main
      Ubuntu 14.04 (Trusty) deb https://apt.signalsciences.net/nginx/distro trusty main
      Ubuntu 12.04 (Precise) deb https://apt.signalsciences.net/nginx/distro precise main
    • Stable flavor

      OS sigsci-nginx.list content
      Ubuntu 15.04 (Vivid) deb https://apt.signalsciences.net/nginx/stable vivid main
      Ubuntu 14.04 (Trusty) deb https://apt.signalsciences.net/nginx/stable trusty main
      Ubuntu 12.04 (Precise) deb https://apt.signalsciences.net/nginx/stable precise main
    • Mainline flavor

      OS sigsci-nginx.list content
      Ubuntu 15.04 (Vivid) deb https://apt.signalsciences.net/nginx/mainline vivid main
      Ubuntu 14.04 (Trusty) deb https://apt.signalsciences.net/nginx/mainline trusty main
      Ubuntu 12.04 (Precise) deb https://apt.signalsciences.net/nginx/mainline precise main
  3. Update the apt caches.

    apt-get update
    
  4. Uninstall the default Nginx.

    sudo apt-get remove nginx nginx-common nginx-full
    
  5. Install the version of Nginx provided by Signal Sciences.

    sudo apt-get install nginx
    

Check Lua is loaded correctly

To verify Lua has been loaded properly load the following config (sigsci_check_lua.conf) with Nginx:

  # Config just to test for lua jit support
  #
  # Test from commandline as follows:
  # nginx -t -c <explicit path>/sigsci_check_lua.conf
  #
  
  # The following load_module directives are required if you have installed
  # any of: nginx110-lua-module, nginx111-lua-module, or nginx-lua-module
  # for your nginx.org installation.
  # Also, for some nginx-1.10.nn installed from nginx-extras package, you may
  # need to specify the load directives.
  # Given the above uncomment the following:
  #
  # load_module modules/ndk_http_module.so;
  # load_module modules/ngx_http_lua_module.so;
  
  events {
      worker_connections 768;
      # multi_accept on;
  }
  http {
  init_by_lua '
  
  local m = {}
  local ngx_lua_version = "dev"
  
  if ngx then
    -- if not in testing environment
    ngx_lua_version = tostring(ngx.config.ngx_lua_version)
    ngx.log(ngx.STDERR, "INFO:", " Check for jit: lua version: ", ngx_lua_version)
  end
  
  local r, jit = pcall(require, "jit")
  if not r then
    error("ERROR: No lua jit support: No support for SigSci Lua module")
  else
  
    if jit then
      m._SERVER_FLAVOR = ngx_lua_version .. ", lua=" .. jit.version
      if os.getenv("SIGSCI_NGINX_DISABLE_JIT") == "true" then
        nginx.log(ngx.STDERR, "WARNING:", "Disabling lua jit because env var: SIGSCI_NGINX_DISABLE_JIT=", "true")
      end
      ngx.log(ngx.STDERR, "INFO:", " Bravo! You have lua jit support=", m._SERVER_FLAVOR)
    else
      error("ERROR: No luajit support: No support for SigSci")
    end
  
  end
  
  ';
  
  }

If the config is successfully loaded, the above script will create the following output:

$ nginx -t -c <your explicit path>/sigsci_check_lua.conf

nginx: [] [lua] init_by_lua:9: INFO: Check for jit: lua version: 10000
nginx: [] [lua] init_by_lua:22: INFO: Bravo! You have lua jit support=10000, lua=LuaJIT 2.0.4
nginx: the configuration file <your explicit path>/sigsci_check_lua.conf syntax is ok
nginx: configuration file <your explicit path>/sigsci_check_lua.conf test is successful

Install the Nginx module

  1. Install the module.

    apt-get install sigsci-module-nginx
    
  2. Add the following to your Nginx configuration file (located by default at /etc/nginx/nginx.conf) in the http context:

    include "/opt/sigsci/nginx/sigsci.conf";
    
  3. Restart the Nginx Service to initialize the new module.

    • Ubuntu 15.04 or higher

      sudo systemctl restart nginx
      
    • Ubuntu 14.04 or lower

      sudo restart nginx