• Resolved ziegel

    (@ziegel)


    Hi,

    Apparently Log records of staging.example.com (it’s configured as independent domain and not as sub-domain)and those of live example.com mix in the two LOG records of the two installations: one in Live and the second in Staging.

    The two use the same Optional configuration file whitelisign several IPs, being placed above root.

    Can you please instruct how to configure each Ninjafirewall plugin isntallation (staging.example.com and example.com) so the records don’t get written on wrong Log files (it happens in both directions)

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author nintechnet

    (@nintechnet)

    Can you run the troubleshooter script on both domains and paste the results here?

    Thread Starter ziegel

    (@ziegel)

    NinjaFirewall (WP edition) troubleshooter
    HTTP server : Apache
    PHP version : 7.4.14
    PHP SAPI : FPM-FCGI

    auto_prepend_file : /var/www/vhosts/example.com/httpdocs/wp-content/nfwlog/ninjafirewall.php
    Loader’s path to firewall : /var/www/vhosts/example.com/staging.example.com/wp-content/plugins/ninjafirewall/lib/firewall.php
    .htninja : found in /var/www/vhosts/example.com/.htninja

    Thread Starter ziegel

    (@ziegel)

    The above was when placed in live example.com

    And when placed in staging.example.com:

    NinjaFirewall (WP edition) troubleshooter
    HTTP server : Apache
    PHP version : 7.4.14
    PHP SAPI : FPM-FCGI

    auto_prepend_file : /var/www/vhosts/example.com/staging.example.com/wp-content/nfwlog/ninjafirewall.php
    Loader’s path to firewall : /var/www/vhosts/example.com/staging.example.com/wp-content/plugins/ninjafirewall/lib/firewall.php
    .htninja : found in /var/www/vhosts/example.com/.htninja

    Plugin Author nintechnet

    (@nintechnet)

    There’s an error here:

    auto_prepend_file : /var/www/vhosts/example.com/httpdocs/wp-content/nfwlog/ninjafirewall.php
    Loader’s path to firewall : /var/www/vhosts/example.com/staging.example.com/wp-content/plugins/ninjafirewall/lib/firewall.php
    

    This is the live site, example.com, but the loader’s location is on the staging site, staging.example.com. When you migrate the site, make sure to follow those instructions: https://blog.nintechnet.com/migrating-a-website-with-ninjafirewall-installed/
    NinjaFirewall needs absolute paths, and reinstalling it (on the live site) will readjust them to match the new server or vhost.

    You can probably try to fix it manually without having to reinstall it:
    1. Open the /var/www/vhosts/example.com/httpdocs/wp-content/nfwlog/ninjafirewall.php script.
    2. Replace /var/www/vhosts/example.com/staging.example.com/wp-content/plugins/ninjafirewall/lib/firewall.php with /var/www/vhosts/example.com/httpdocs/wp-content/plugins/ninjafirewall/lib/firewall.php. There should be two occurrences to replace.

    Thread Starter ziegel

    (@ziegel)

    May I change this file to be:

    ******************************************
    <?php
    // ===============================================================//
    // NinjaFirewall’s loader. //
    // DO NOT alter or remove it as long as NinjaFirewall is running! //
    // ===============================================================//
    if ( file_exists(‘/wp-content/plugins/ninjafirewall/lib/firewall.php’) ) {
    @include_once ‘/wp-content/plugins/ninjafirewall/lib/firewall.php’;
    }
    // EOF
    ******************************************

    So it will SYNC from staging to live without any need for any manual adjustments?

    Thread Starter ziegel

    (@ziegel)

    Note: My AS-OF sub-domain staging.example.com is not a sub domain, but configured as as independent domain.

    Plugin Author nintechnet

    (@nintechnet)

    /wp-content/plugins/ninjafirewall/lib/firewall.php doesn’t look correct, that’s not the absolute path. According to your previous messages, it seems to be /var/www/vhosts/example.com/httpdocs/wp-content/plugins/ninjafirewall/lib/firewall.php

    Thread Starter ziegel

    (@ziegel)

    Absolute pathes cause problems on Sync from staging to live. This is a common thing.

    Our website is built of relative pathes and works just fine.

    May I aks, why do you fear the relative path wouldn’t work properly?

    Plugin Author nintechnet

    (@nintechnet)

    If relative paths work for you then no problem. But /wp-content/plugins/ninjafirewall/lib/firewall.php doesn’t look like a relative path because it starts with a ‘/’ slash (unless you chrootred your vhost).
    From the /var/www/vhosts/example.com/httpdocs/wp-content/nfwlog/ninjafirewall.php script, the relative path to the plugins folder should look like ../plugins/ninjafirewall/lib/firewall.php.

    Thread Starter ziegel

    (@ziegel)

    Thanks. I’ll test.

    Note, I’m pretty sure the comment:
    “From the /var/www/vhosts/example.com/httpdocs/wp-content/nfwlog/ninjafirewall.php script, the relative path to the plugins folder should look like ../plugins/ninjafirewall/lib/firewall.php.”

    Is wrong, as it’s a path the plugin deliberately created for data to be outside (external) of the plugin folder/directory (which is also a part of wp-content folder/directoy).

    Ehud

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Staging subdomian mixes log with Live main domain’ is closed to new replies.