• 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!
  • 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.

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