• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

Nginx IP protected directory not working

Patrick1

New Pleskian
Dear readers,

I searched the web endlessly but cant seem to figure this out.

I have several customers with wordpress domains. I want to protect these directory's with Nginx on a plesk 12 machine. I thought something simple will do, but i just spent all sunday afternoon getting it to work (what else is new)
.
I thought ;
location /wp-admin/ {
allow 123.123.123.123;
deny all;
satisfy all;
}
would do the trick, but no go, nginx isnt passing it to apache by the looks of it. I tried all kinds of possible solutions but cant get it to work. It works with files though. The logfile says directory index of "/var/www/vhosts/testdomain.eu/httpdocs/wp-admin/" is forbidden. This makes sense, since its turned off.

any suggestion on how to get this to work with plesk 12 and nginx ?
Regards,
Patrick
 
I figured out where the real problem is, its is because nginx talks to apache, so apache thinks that all requests
are coming from nginx.
I found out that X-real-IP is forwared to apache, but i cant make use of that in .htaccess.

So, how can i still make use of .htaccess files ?

Patrick
 
Found it.

Like i said, the real problem is that all calls to apache come from nginx.
To make use of the .htaccess again do the following in .htaccess;

Deny from All
SetEnvIF X-Forwarded-For "1.2.3.4" AllowIP
SetEnvIF X-Forwarded-For "2.3.4.5" AllowIP
Allow from env=AllowIP
Allow from 1.2.3.4
Allow from 2.3.4.5

then you can mak use of the .htaccess again like you used to.
I hope i save someone some time with this post.

Patrick
 
Back
Top