---
title: Kong plugin install
summary: null
url: >-
  https://www.fastly.com/documentation/guides/next-gen-waf/setup-and-configuration/module-agent-deployment/kong
---

The Kong plugin is a feature of the NGINX module, which allows it to function as a Kong plugin. Accordingly, the process for installing the Kong plugin involves installing the Next-Gen WAF agent and NGINX module, and modifying the NGINX module configuration to enable it for use with Kong.

## Installation

1. Install the [Next-Gen WAF agent for your environment](https://www.fastly.com/documentation/guides/next-gen-waf/setup-and-configuration/module-agent-deployment/about-module-agent-deployment#verifying-your-installation).

2. Edit the agent configuration file located at `/etc/sigsci/agent.conf` to add the following lines. Replace `` with the host IP address (usually `127.0.0.1`) and `` with the TCP port on which the agent will listen for connections from the module. There is no default, but we suggest port `737` to minimize the chance of conflicts with other services:

   ```text
   rpc-address=:
   ```

3. Download and extract the latest Next-Gen WAF NGINX module from one of our websites.

   ### Dl.Security.Fastly.Com

   ```term copy nolinenums
   $ curl -O  https://dl.security.fastly.com/sigsci-module-nginx/sigsci-module-nginx_latest.tar.gz
   $ sudo mkdir -p /opt/sigsci/nginx
   $ sudo tar -xf sigsci-module-nginx_latest.tar.gz -C /opt/sigsci/nginx
   ```

   ### Dl.Signalsciences.Net

   ```term copy nolinenums
   $ curl -O  https://dl.signalsciences.net/sigsci-module-nginx/sigsci-module-nginx_latest.tar.gz
   $ sudo mkdir -p /opt/sigsci/nginx
   $ sudo tar -xf sigsci-module-nginx_latest.tar.gz -C /opt/sigsci/nginx
   ```

   

4. If you are on Kong 3.0.x, override the `handler.lua` and `schema.lua` files in `/opt/sigsci/nginx/sigsci-module-nginx/kong/plugins/signalsciences` with the `handler.lua` and `schema.lua` files in `/opt/sigsci/sigsci-module-nginx/nginx/kong/plugins/signalsciences-3.0.x`.

5. Edit the following lines in `/opt/sigsci/nginx/sigsci-module-nginx/kong/plugins/signalsciences/handler.lua` to reflect the host IP address and the port used for communication with the agent. Replace `"localhost"` and `12345` with the host IP address and port:

   ```text
   sigsci.agenthost = "localhost"
   sigsci.agentport = 12345
   ```

6. In the Kong configuration file at `/etc/kong/kong.conf`, add the following lines:

   ```text
   plugins=signalsciences
   lua_package_path=/opt/sigsci/nginx/sigsci-module-nginx/?.lua
   ```

7. Enable the Kong plugin by running the following command. Replace `` with the Kong IP address and port (for example, `127.0.0.1:1234`):

   ```term copy
   $ curl -i -X POST --url http:///plugins/ --data 'name=signalsciences'
   ```

## Related content

- [About module-agent deployment](https://www.fastly.com/documentation/guides/next-gen-waf/setup-and-configuration/module-agent-deployment/about-module-agent-deployment)
- [Using an API with the Next-Gen WAF](https://www.fastly.com/documentation/guides/next-gen-waf/developer/using-an-api-with-the-next-gen-waf)
