• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question How to override WP Toolkit Nginx "Deny All" for PHP script in WordPress wp-content directory

Christopher McBride

Basic Pleskian
Hi,

I have a WordPress installation with a plugin to combat spam that has a PHP file to dynamically create a Javascript file located in the plugin's directory within the wp-content folder.

Utilising the WP Toolkit to "secure" the WordPress installation, it adds .htaccess and nginx configurations to prevent the accessing of php files within the wp-content and wp-includes directories.

The plugin has overridden the .htaccess file itself with it's own .htaccess in the plugin folder, however the nginx configuration to override this is eluding me.


The WP Toolkit adds the following into the vhosts's nginx configuration file:
#extension wp-toolkit begin
location ~* wp-config.php { deny all; }

location ~* "^/wp-content/.*\.php" { deny all; }
location ~* "^/wp-includes/.*\.php" { deny all; }

#extension wp-toolkit end


I wish to override this to allow access to the file at /wp-content/plugins/wp-spamshield/js/jscripts.php at a global server level.

I have tried doing this on an individual vhost level with the additional nxginx directives, but nothing appears to be working.

I've tried simply:

location /wp-content/plugins/wp-spamshield/js/jscripts.php {allow all;}

And more advanced:

location /wp-content/plugins/wp-spamshield/js/jscripts.php {
proxy_pass http://x.x.x.x:7080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
allow all;
}



Can anyone help to get this overridden for all vhosts, please?
 
Hi. I have similar problem, and I disabled "wp-config deny rule" in the WordPress menu in Plesk.
Go to WordPress, choose the installation you want disable some secure rules, and then click “View” next to “Security status” on the installation card.
Find needed wp-config rule and disable
Screenshot_17.png
 
Back
Top