Skip to content

Magento 2 Restrict access to admin

I am trying to limit access to my Magento 2 admin panel via nginx using

location ~* ^/(index.php/admin|admin) {
    00.00.00.00;

    try_files $uri $uri/ /index.php?$args;
    location ~* .php$ { try_files /dummy @proxy; }
    deny all;
}

The problem I have is I am on a Plesk server and the site is setup with nginx in Proxy mode so all traffic is blocked to admin because I guess its not seeing my ip because of the proxy.

Does anyone have a workaround for this?