• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Limit access to URL by IP address using nginx

Paul Larson

Basic Pleskian
I'm at my wits end on this one.

I have a URL example.com/order-export

I want access to that URL to be limited by IP address.

When I make a physical Linux directory, order-export, the Nginx config below works:

location = /order-export {
allow 1.2.3.4;
deny all;
}

Now, after I remove order-export, that same URL is handled by my CMS (ExpressionEngine). example.com/order-export remains browsable.

What might I be missing, such that the Nginx rule will work for dynamic URLs rather than physical directories?
 
Update: I do use the Reverse Proxy Server (nginx) setting on this Plesk server.

Might my rules need to be adjusted to know about the local proxy IP and port? (I'm not sure what those would be)
 
Nginx only processes static files unless you turn the proxy option off. So probably the directive is ineffective, because the CMS uses .php files?
 
Peter,

How exactly do I turn of the Nginx proxy, but maintain Nginx as the web server for that domain? Seems if I disable the Reverse Proxy (nginx) Service in Plesk, I no longer get an 'Nginx' option when I select the PHP version for a domain.
 
No, sorry, you are asking something different. You do NOT want to disable Nginx. You want to run all through Nginx, right? When you want to serve PHP through Nginx you want Nginx-only hosting. In that case simply uncheck the Proxy box in the Apache & Nginx settings dialog.
 
Back
Top