admin.php blocked(hide) ip

dutyfree

Member
The situation is as follows I have 2 servers. 1 is responsible for backend (all forum files are located there) 2 is responsible for proxy (translates front and sends requests to back server). How can I deny access to /admin.php for all ip except mine conditionally 94.23.67.54. Should I configure the rule in which file and on which server (front or back). On back server apache works, on front nginx. I do this on the backend in the main root .htaccess
<Files “admin.php”>
Order allow,deny
Allow from 94.23.67.54
Deny from all
</Files>
 
configure the access restriction on the front-end (Nginx) server

Code:
location /admin.php {
  # Restrict access based on IP address
  allow 94.23.67.54;
  deny all;

  # Proxy requests to the backend server (if needed)
  proxy_pass http://<backend_server_ip>/admin.php;  # Replace with actual backend server IP
}
 
configure the access restriction on the front-end (Nginx) server

Code:
location /admin.php {
  # Restrict access based on IP address
  allow 94.23.67.54;
  deny all;

  # Proxy requests to the backend server (if needed)
  proxy_pass http://<backend_server_ip>/admin.php;  # Replace with actual backend server IP
}
Code:
load_module /usr/lib/nginx/modules/ngx_stream_module.so;

events {}

http { 
    server_tokens off;

    server {
        listen 80;
        return 301 https://domain.com/;

        location /admin.php {
            # Restrict access based on IP address
            allow white_ip;
            deny all;

            # Proxy requests to the backend server
            proxy_pass http://<backend_server_ip>/admin.php;  # Replace with actual backend server IP


        }
    }
}

stream {
    server {
        listen 443;
        proxy_pass ip_back:443;
    }
}

no work( admin access anything ip....
 
Back
Top Bottom