Skip to content

Instantly share code, notes, and snippets.

@mike-moreau
Created September 16, 2025 18:36
Show Gist options
  • Save mike-moreau/35f7c04cfb6eca5c4ef9a0cf72056c28 to your computer and use it in GitHub Desktop.
Save mike-moreau/35f7c04cfb6eca5c4ef9a0cf72056c28 to your computer and use it in GitHub Desktop.
Block access to admin.php by IP address in NGINX (Laravel Forge)
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/www.example.com/before/*;
server {
location /admin {
allow 123.456.789.001; # your ip here
deny all;
try_files $uri $uri/ /index.php?$query_string;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
}
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/www.example.com/after/*;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment