I think that I misunderstood your question. You are probably referring to the script used to load the firewall, /wp-content/nfwlog/ninjafirewall.php
, not to the log?
In that case, you will need to create a specific script that will the load the correct firewall, i.e., the one from the site your visitor is requesting.
There is an example in our blog: https://blog.nintechnet.com/installing-ninjafirewall-with-hhvm-hiphop-virtual-machine/ (scroll down to the Multiple-site installation section). Although it covers HHVM, it is the same issue: one single PHP INI file used to load multiple sites.
Example:
Your document root is: /home/user/
You have 3 domains inside that folder:
1. /home/user/domain01.com/
2. /home/user/domain02.com/
3. /home/user/domain03.com/
Create a script named /home/user/route.php
in your document root folder and add this code to it:
<?php
if ( strpos($_SERVER['SCRIPT_FILENAME'], '/home/user/domain01.com') !== false ) {
// Load NinjaFirewall for domain01.com:
if ( file_exists( '/home/user/domain01.com/wp-content/nfwlog/ninjafirewall.php' ) ) {
require('/home/user/domain01.com/wp-content/nfwlog/ninjafirewall.php');
}
} elseif ( strpos($_SERVER['SCRIPT_FILENAME'], '/home/user/domain02.com') !== false ) {
// Load NinjaFirewall for domain02.com:
if ( file_exists( '/home/user/domain02.com/wp-content/nfwlog/ninjafirewall.php' ) ) {
require('/home/user/domain02.com/wp-content/nfwlog/ninjafirewall.php');
}
} elseif ( strpos($_SERVER['SCRIPT_FILENAME'], '/home/user/domain03.com') !== false ) {
// Load NinjaFirewall for domain03.com:
if ( file_exists( '/home/user/domain03.com/wp-content/nfwlog/ninjafirewall.php' ) ) {
require('/home/user/domain03.com/wp-content/nfwlog/ninjafirewall.php');
}
}
Then, in the Dreamhost phprc file, replace the current NinjaFirewall line with the full path to the ‘route.php’ script:
; NinjaFirewall: load route.php
auto_prepend_file = /home/user/route.php
Note that I used $_SERVER['SCRIPT_FILENAME']
to load the correct firewall, but as you’ll see in the HHVM article, other environment variables could be used to check which site is being visited, such as $_SERVER['SERVER_NAME']
etc.