Как закрыть доступ по IP в NGINX + PHP-Fpm?

Всем привет. Есть сайт, который работает на связке Nginx + php-fpm на панели управления Ajenti на Wordpress

Вот нужно заблокировать доступ по IP всем, кроме моего IP адреса.
Я добавлял например такое
location ~ / { #allow мой ИП; deny all; }

Но тогда сайт пхп не загружается, а скачивает Индексный файл пхп.

Подскажите как настроить правильно такое…

Вот конфиг
/etc/nginx/conf.d/мой-сайт.conf
# This order might seem weird — this is attempted to match last if rules below fail. location / { try_files $uri $uri/ /index.php?$args; } # Add trailing slash to */wp-admin requests. rewrite /wp-admin$ $scheme://$host$uri/ permanent; # Directives to send expires headers and turn off 404 error logging. location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { access_log off; log_not_found off; expires max; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac). # Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban) location ~ /\. { deny all; } # Deny access to any files with a .php extension in the uploads directory # Works in sub-directory installs and also in multisite network # Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban) location ~* /(?:uploads|files)/.*\.php$ { deny all; } #

Нет комментариев