How to setup NinjaFirewall Full WAF for RunCloud OLS

Written by

Jannick Nijholt

Published on

16/08/2024

Last update

28/08/2024
BlogUncategorized

Step 1: Get NinjaFirewall Full WAF details

  • Log in to WordPress
  • Go to NinjaFirewall
  • Hit the button ‘Activate Full WAF
  • Select the Openlitespeed configuration and take note of the auto_prepend_file rule you have to add to your server. This will look like this:
    • php_value auto_prepend_file "/home/[user]/webapps/[application-name]/wp-content/nfwlog/ninjafirewall.php"

Step 2: Configuration in RunCloud

  • Log in to RunCloud
  • Browse to your application in RunCloud
  • Go to ‘LiteSpeed Config
  • In ‘Config Content’ look for the rule that looks like env PHP_LSAPI_CHILDREN=35
  • Make a copy of this rule underneath and replace PHP_LSAPI_CHILDREN=35 for LSPHP_ENABLE_USER_INI=on
Configuration settings for PHP-LSAPI environment.

Step 3: Configuration in your server

  • Connect to your server using SFTP (for example using Cyberduck)
  • Go to the following folder
    • /home/[user]/lsphp/[application-name]
  • Create a new file named .user.ini
  • Add the NinjaFirewall Full WAF configuration like this to the .user.ini file
    • auto_prepend_file = '/home/[user]/webapps/[application-name]/wp-content/nfwlog/ninjafirewall.php'

Step 4: Reload PHP settings in RunCloud

  • Go back to RunCloud
  • Go to the ‘Settings’ of your Web Application
  • Find the ‘PHP Settings’ section and hit the button ‘Update PHP Settings
Update PHP settings button

Step 5: Check if Full WAF is active for NinjaFirewall

  • Go back to WordPress
  • Go to NinjaFirewall and look if the mode has changed to Full WAF mode
NinjaFirewall enabled in Full WAF mode.
Profile Picture of Jannick Nijholt

Question, comment or an idea?

Shoot me an email!
You can reach me on [email protected]