• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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