search close

Alpine Linux NGINX 1.15.3+

access_time Updated Sep 21, 2021

Note: The Nginx Module for Alpine Linux requires Nginx v1.15.3 or higher.

Add the Package Repositories

We’ll first add in the Signal Sciences apk repositories as this simplifies the installation process:

apk update && apk add wget
wget https://apk.signalsciences.net/sigsci_apk.pub ; mv sigsci_apk.pub /etc/apk/keys
echo https://apk.signalsciences.net/3.12/main | tee -a /etc/apk/repositories && apk update
sudo apk update && sudo apk add wget
sudo wget -q https://apk.signalsciences.net/sigsci_apk.pub ; sudo mv sigsci_apk.pub /etc/apk/keys
sudo echo https://apk.signalsciences.net/3.12/main | sudo tee -a /etc/apk/repositories && sudo apk update
apk update && apk add wget
wget https://apk.signalsciences.net/sigsci_apk.pub ; mv sigsci_apk.pub /etc/apk/keys
echo https://apk.signalsciences.net/3.11/main | tee -a /etc/apk/repositories && apk update
sudo apk update && sudo apk add wget
sudo wget -q https://apk.signalsciences.net/sigsci_apk.pub ; sudo mv sigsci_apk.pub /etc/apk/keys
sudo echo https://apk.signalsciences.net/3.11/main | sudo tee -a /etc/apk/repositories && sudo apk update

Optional: Verify Signing Key

Verify the downloaded key contains the proper key:

openssl rsa -pubin -in /etc/apk/keys/sigsci_apk.pub -text -noout

Expected modulus output:

Public-Key: (2048 bit)
Modulus:
    00:bb:23:1a:ef:0d:61:8f:8d:55:aa:ad:01:84:43:
    6c:46:42:42:ab:5b:ec:4e:4b:e2:e6:b6:e7:3d:45:
    b7:96:70:fe:16:95:aa:09:f1:90:82:40:e4:30:2b:
    9e:2a:03:e9:74:63:55:66:f0:db:8c:b9:5b:f8:45:
    5f:ad:4e:7a:14:da:02:83:c2:36:a0:84:74:a0:bb:
    f9:3f:03:c8:fe:80:6a:95:0c:17:22:55:40:30:18:
    51:d9:30:db:7c:1b:d0:06:4e:a9:51:1a:31:0e:33:
    f0:6e:ad:53:98:31:a5:ac:a3:a1:44:83:72:a1:ca:
    78:e3:24:70:ab:7a:0e:66:32:3b:f6:c9:90:16:dc:
    89:d0:52:7a:50:a8:f8:59:0a:34:12:2e:85:11:f5:
    80:0d:d4:7d:a7:7b:3b:d7:d9:1e:28:ed:bb:f7:08:
    2e:9f:73:a5:23:d8:53:b4:7e:21:dd:ae:92:4a:d0:
    5b:86:21:9c:82:05:21:29:eb:c1:ab:91:cd:1a:7b:
    95:6d:43:d3:1a:a9:62:2b:b0:95:9e:cf:18:82:64:
    02:f9:38:7e:7f:47:9f:d9:f3:ac:fd:2c:30:ff:75:
    b1:11:27:1c:7a:d6:ca:04:19:f8:31:80:42:e9:4a:
    0d:ab:d5:b8:ad:f2:35:31:a5:3f:98:19:99:fc:29:
    e8:4f
Exponent: 65537 (0x10001)

Install the Module With apk

Install the module by running the following command, replacing “NN.NN” with your Nginx version number:

apk add nginx-module-sigsci-nxo-1.NN.NN

Update the Nginx Configuration

Edit your nginx.conf file located by default at /etc/nginx/nginx.conf. Add the following lines to the global section. For example after the pid /run/nginx.pid; line add:

load_module /etc/nginx/modules/ngx_http_sigsci_module.so;
load_module /etc/nginx/modules/ndk_http_module.so;

Restart the Nginx web service

Restart Nginx running on a VM and bare-metal:

sudo service nginx restart
sudo rc-service nginx restart