Debian NGINX 1.9 or lower

Add the package repositories

Add the version of the Debian package repository that you want to use.

Debian 10 - Buster

$ sudo apt-get update
$ sudo apt-get install -y apt-transport-https wget gnupg
$ wget -qO - https://apt.signalsciences.net/release/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/sigsci.gpg
$ sudo echo "deb [signed-by=/usr/share/keyrings/sigsci.gpg] https://apt.signalsciences.net/release/debian/ buster main" | sudo tee /etc/apt/sources.list.d/sigsci-release.list
$ sudo apt-get update

Debian 9 - Stretch

$ sudo apt-get install -y apt-transport-https wget gnupg
$ wget -qO - https://apt.signalsciences.net/release/gpgkey | sudo apt-key add -
$ sudo tee /etc/apt/sources.list.d/sigsci-release.list <<-'EOF'
deb https://apt.signalsciences.net/release/debian/ stretch main
EOF
$ sudo apt-get update

Debian 8 - Jessie

$ sudo apt-get install -y apt-transport-https wget
$ wget -qO - https://apt.signalsciences.net/release/gpgkey | sudo apt-key add -
$ sudo tee /etc/apt/sources.list.d/sigsci-release.list <<-'EOF'
deb https://apt.signalsciences.net/release/debian/ jessie main
EOF
$ sudo apt-get update

Debian 7 - Wheezy

$ sudo apt-get install -y apt-transport-https wget
$ wget -qO - https://apt.signalsciences.net/release/gpgkey | sudo apt-key add -
$ sudo tee /etc/apt/sources.list.d/sigsci-release.list <<-'EOF'
deb https://apt.signalsciences.net/release/debian/ wheezy main
EOF
$ 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:

OSDistributionStableMainline
Debian 8 (Jessie)1.6.21.8.11.9.10
Debian 7 (Wheezy)1.2.11.8.11.9.10

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

Apt repository setup for Debian 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

      OSsigsci-nginx.list content
      Debian 8 (Jessie)deb https://apt.signalsciences.net/nginx/distro jessie main
      Debian 7 (Wheezy)deb https://apt.signalsciences.net/nginx/distro wheezy main
    • Stable flavor

      OSsigsci-nginx.list content
      Debian 8 (Jessie)deb https://apt.signalsciences.net/nginx/stable jessie main
      Debian 7 (Wheezy)deb https://apt.signalsciences.net/nginx/stable wheezy main
    • Mainline flavor

      OSsigsci-nginx.list content
      Debian 8 (Jessie)deb https://apt.signalsciences.net/nginx/mainline jessie main
      Debian 7 (Wheezy)deb https://apt.signalsciences.net/nginx/mainline wheezy 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 Fastly.

    $ 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:

1# Config just to test for lua jit support
2#
3# Test from commandline as follows:
4# nginx -t -c <explicit path>/sigsci_check_lua.conf
5#
6
7# The following load_module directives are required if you have installed
8# any of: nginx110-lua-module, nginx111-lua-module, or nginx-lua-module
9# for your nginx.org installation.
10# Also, for some nginx-1.10.nn installed from nginx-extras package, you may
11# need to specify the load directives.
12# Given the above uncomment the following:
13#
14# load_module modules/ndk_http_module.so;
15# load_module modules/ngx_http_lua_module.so;
16
17events {
18 worker_connections 768;
19 # multi_accept on;
20}
21http {
22init_by_lua '
23
24local m = {}
25local ngx_lua_version = "dev"
26
27if ngx then
28 -- if not in testing environment
29 ngx_lua_version = tostring(ngx.config.ngx_lua_version)
30 ngx.log(ngx.STDERR, "INFO:", " Check for jit: lua version: ", ngx_lua_version)
31end
32
33local r, jit = pcall(require, "jit")
34if not r then
35 error("ERROR: No lua jit support: No support for SigSci Lua module")
36else
37
38 if jit then
39 m._SERVER_FLAVOR = ngx_lua_version .. ", lua=" .. jit.version
40 if os.getenv("SIGSCI_NGINX_DISABLE_JIT") == "true" then
41 nginx.log(ngx.STDERR, "WARNING:", "Disabling lua jit because env var: SIGSCI_NGINX_DISABLE_JIT=", "true")
42 end
43 ngx.log(ngx.STDERR, "INFO:", " Bravo! You have lua jit support=", m._SERVER_FLAVOR)
44 else
45 error("ERROR: No luajit support: No support for SigSci")
46 end
47
48end
49
50';
51
52}

You can load the script by running the following command:

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

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

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.

    • Debian 8 or higher

      $ sudo systemctl unmask nginx && sudo systemctl restart nginx
    • Debian 7

      $ sudo service nginx restart
Was this guide helpful?

Do not use this form to send sensitive information. If you need assistance, contact support. This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.