Authentication and Access Control

1 min read

Authors
banner

Authentication and Access Control

Basic Auth

location /admin {
    auth_basic "Admin Area";
    auth_basic_user_file /etc/nginx/.htpasswd;
}

Create Password File

sudo htpasswd -c /etc/nginx/.htpasswd admin

IP Whitelist

location /admin {
    allow 192.168.1.0/24;
    allow 10.0.0.5;
    deny all;
}

Limit Methods

location ~ \.php$ {
    limit_except GET POST {
        deny all;
    }
}

Protected!

© 2025 Vijay Rajendran