• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

Resolved Where to put apache and nginx global rewrite rules?

tkalfaoglu

Silver Pleskian
I have this code for our main site to stop the pesky crawlers in our main site's hosting settings:

Apache & nginx Settings for kalfaoglu.net :

Code:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} (SemrushBot|PetalBot|DotBot|gumgum-bot|postmanruntime|ag_dm_spider|scrapy|chimebot|trendkite-akashic-crawler|ZoominfoBot|Sogou|ALittle|Keybot|Buck|curl|webpr
osbot|RestSharp|Snap|SemrushBot|AhrefsBot|DataForSeoBot|Sogou|trendkite-akashic-crawler|cortex|ALittle|Go-http-client|RestSharp) [NC]
RewriteRule .* - [F,L]

and for nginx:

Code:
if ($http_user_agent ~ (SemrushBot|PetalBot|DotBot|gumgum-bot|postmanruntime|ag_dm_spider|scrapy|chimebot|trendkite-akashic-crawler|ZoominfoBot|Sogou|ALittle|Keybot|Buck|curl|webprosbot|RestSharp|Snap|SemrushBot|AhrefsBot|Da
taForSeoBot|Sogou|trendkite-akashic-crawler|cortex|ALittle|Go-http-client|RestSharp|MJ12bot)) {
        return 403;
}

I would like to make this applied to all sites we host. How do I go about making this globally for every site we host/will host?

Many thanks, -t
 
You could put those directives in your own file in /etc/httpd/conf.d and /etc/nginx/conf.d
Use a filename like "zzz_mytweaks.conf" or similar to make sure it is included as the last file
 
Many thanks! I created that zzz_mytweaks.conf, did a httpdmng --reconfigure-domain, but I do not see my changes in the vhost.conf of that domain. Am I suppose to see them there? I mean, how can I tell if my conf is included in the httpd conf?
 
Many thanks! I created that zzz_mytweaks.conf, did a httpdmng --reconfigure-domain, but I do not see my changes in the vhost.conf of that domain. Am I suppose to see them there? I mean, how can I tell if my conf is included in the httpd conf?
In fact, I don't see it anywhere in the /etc/httpd (recursively searched) or in /var/www/vhosts/kalfaoglu.net/conf directories.. I only see it my zzz_mytweaks file. Shouldn't I see it in my kalfaoglu.net conf files too?

Thanks!
 
Shouldn't I see it in my kalfaoglu.net conf files too?

Nope, you won't see those files anywhere except where you've created them (/etc/httpd/conf.d/zzz_mytweaks.conf and/or /etc/nginx/conf.d/zzz_mytweaks.conf)
Once you've created them, a simple reload of Apache + nginx is enough

Note: If you're on Debian or Ubuntu, the Apache global config is in /etc/apache2/conf.d

See also: Apache and Nginx Configuration Files
 
Back
Top