Nginx HTTP basic auth – allowing IP or password-based access

nginx uses similar syntax to that of Apache to allow users to access a directory, depending if their IP or username/pass matches (i.e. you want all users to present a valid username/pass match, but want to let some automated checks coming from specified IPs through, i.e. from ldirectord or nagios). Here is an example to use both HTTP basic auth and IP based auth.


You can create/modify the auth_basic_user_file with htpasswd program (typically found in apache2-utils or apache-base package, depending on the distribution):

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Lxadm.com.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.