Installation
Installing From Repository
Currently supported NGINX packages:
- The official NGINX package shipped with Debian/Ubuntu.
- The stable NGINX package from the official NGINX PPA.
- The stable OpenResty package.
- Download and run the installation shell script (must be executed by
root
user):
apt update
apt install -y curl
curl -fsSL https://perimeterx.jfrog.io/artifactory/sh/px-installation.sh | bash
- Add the following lines to the top of your
/etc/nginx/nginx.conf
file:
thread_pool px_pool threads=10;
load_module /usr/lib/nginx/modules/ngx_http_pxnginx_module.so;
Installing From Source
Compiling and Installing PerimeterX NGNIX Module as a Dynamic Module
- Install the module dependencies:
apt update
apt install -y libjansson-dev libcurl4-openssl-dev libapr1-dev libaprutil1-dev libssl-dev build-essential devscripts libtool m4 automake pkg-config
yum update
yum install jansson-devel libcurl-devel openssl-devel apr-devel apr-util-devel gcc make libtool pcre-devel
-
Run
nginx -V
to get the installed NGINX compilation flags. -
Copy the list of compilation flags which are next to
configure arguments:
string (i.e.:--with-cc-opt=...
). We will use this list of flags when we configure NGNIX with the PerimeterX module next. -
In your NGNIX source folder, run
./configure --add-dynamic-module=<PATH>/modules/nginx
and append the list of compilation flags from the previous step.
Note: should be replaced with the full path to PerimeterX module's root folder from the source code.
Your configure
command should look similar to this example:
./configure --add-dynamic-module=/home/ubuntu/perimeterx-c-core/modules/nginx --with-cc-opt='-g' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock
-
Compile NGNIX and the PerimeterX dynamic module by running
make
from the NGNIX source folder. -
As a root user, copy the dynamic module from the
objs
folder to NGNIX's modules folder:
cp objs/ngx_http_pxnginx_module.so /usr/lib/nginx/modules/
Note: Depending on your distro, the NGNIX modules folder might be located under a different path.
- Add the following lines to the top of your
nginx.conf
file:
load_module /usr/lib/nginx/modules/ngx_http_pxnginx_module.so;
thread_pool px_pool threads=10;
Note: As noted on the previous step, the location of the
ngx_http_pxnginx_module.so
might be different in your setup.
Compiling and Installing PerimeterX NGNIX Module as a Built-In Module
- Install the module dependencies:
apt update
apt install -y libjansson-dev libcurl4-openssl-dev libapr1-dev libaprutil1-dev libssl-dev build-essential devscripts libtool m4 automake pkg-config
yum update
yum install jansson-devel libcurl-devel openssl-devel apr-devel apr-util-devel gcc make libtool
- In your NGNIX source folder, run
./configure --add-module=[PATH]/modules/nginx --with-threads
.
Note: should be replaced with the full path to the PerimeterX module's root folder from the source code.
The configuration can look as follows:
./configure --add-module=/home/ubuntu/perimeterx-c-core/modules/nginx --with-threads [add extra NGINX compilation flags]
- Compile NGNIX by running the following commands:
make
sudo make install
- Add the following lines to the top of your
nginx.conf
file:
thread_pool px_pool threads=10;
Updated 6 months ago