mitchellkrogza / nginx-ultimate-bad-bot-blocker

Nginx Block Bad Bots, Spam Referrer Blocker, Vulnerability Scanners, User-Agents, Malware, Adware, Ransomware, Malicious Sites, with anti-DDOS, Wordpress Theme Detector Blocking and Fail2Ban Jail for Repeat Offenders
Other
3.81k stars 472 forks source link

[INSTALLATION] (Installing NUBBB within a Plesk Hosting Control Programme - Obsidian ) #463

Closed SubliminalClip closed 2 years ago

SubliminalClip commented 2 years ago

Most notably, is the storage of domain specific nginx modifications here: /var/www/vhosts/system/hosted-domain-name/conf/ in both nginx.conf (see note ++) and _vhost_nginx.conf (see note +++) files, plus, just as importantly, the total absence of the required: /etc/nginx/sites-available/_ directory.

++ This file is auto-generated and contains modification warning as follows: ATTENTION! DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY, SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

+++ This file is nearly always usually created via Plesk Panel GUI not via CLI

In theory, this, should be relatively straightforward to resolve, by way of a modified script to suit this type of Plesk installation. See suggestion in Additional Information at the end of this issue for more details. At the time of writing this post, the current, most advanced Plesk HCP is Plesk Obsidian. More than happy to liaise and beta test (alongside others if needed) any modified scripts that may be produced. as this Bot Blocker would be a very welcome addition to Plesk HCP users.

Only those that are to be expected:


# ./setup-ngxblocker
find: ‘/etc/nginx/sites-available’: No such file or directory
Configure every file above as a vhost ? [Y/N] : N
using a file extension for vhost files allows multiple domains to be included with a single directive in nginx.conf:
include /etc/nginx/sites-enabled/*.vhost;
see command line switches below: -e to customise the vhost file extension
no vhost files in: [ /etc/nginx/sites-available/*.vhost ] => exiting.

By default, the Plesk provided /etc/nginx/nginx.conf does include: *include /etc/nginx/conf.d/.conf;** within http { }

Plesk users are able (and we have already) added self-generated *.conf files within: /etc/nginx/conf.d/ all of which operate successfully (within nginx) on all hosted domains. The following statement makes perfect sense (for normal OS):

This setup-ngxblocker script assumes that all your vhost files located in /etc/nginx/sites-available end in an extension .vhost. It is good practice to make all your vhost config files end with a .vhost extension but if you prefer to stick what you already have eg .conf you can simply modify run setup-ngxblocker using the -e parameter to specify the extension you use for your vhost files.

The issue within Plesk however, is both the name & location of default vhost files, those posted above and also this one: /var/www/vhosts/system/hosted-domain-name/conf/vhost.conf

Is it possible (?) to invoke this functionality with within Plesk via just one, newly created /etc/nginx/conf.d/nubbb.conf :o)) file (as well as all of the other *.conf files that are provided within the standard scripts) instead of, the default actions?

mitchellkrogza commented 2 years ago

The setup-ngxblocker as it stands now will never work for a plesk environment. You will simply need to place the relevant files in conf.d and bots.d and add the includes manually into your server {} block - see the manual configuration readme. I don't have Plesk so can't add any logic into the setup or install for it.

SubliminalClip commented 2 years ago

The setup-ngxblocker as it stands now will never work for a plesk environment. You will simply need to place the relevant files in conf.d and bots.d and add the includes manually into your server {} block - see the manual configuration readme. I don't have Plesk so can't add any logic into the setup or install for it.

That's a quick reply. Much appreciated. Okay, we'll do that and post back the results in due course. Other Plesk users may then have a point of reference, if they want to do the same (some definitely will!).