1. Install the Lua modules provided by NGINX
-
For Amazon Linux, CentOS, and RHEL:
yum install nginx-plus-module-lua
-
For Ubuntu:
apt-get install nginx-plus-module-lua
sudo yum -y remove nettle
Download and compile nettle using the version appropriate for your environment:
For Amazon Linux, CentOS, and RHEL:
yum -y install m4 # prerequisite for nettle
cd /tmp/
wget https://ftp.gnu.org/gnu/nettle/nettle-3.3.tar.gz
tar -xzf nettle-3.3.tar.gz
cd nettle-3.3
./configure
make install
sudo yum install luarocks
sudo luarocks install lua-cjson
sudo luarocks install lustache
sudo luarocks install lua-resty-nettle
sudo luarocks install luasocket
sudo luarocks install lua-resty-http
sudo luarocks install perimeterx-nginx-plugin
On CentOS 7 and other Linux operating systems you may need to modify or disable Selinux. If you get the following error:
nginx: lua atpanic: Lua VM crashed, reason: runtime code generation failed, restricted kernel?
You will need to make one of the following changes:
- To disable SELinux:
RUN setenforcer 0
- To enable execmem for httpd_t:
RUN setsebool httpd_execmem 1 -P